Date: Wed, 7 May 2003 01:35:29 -0700 From: Hiten Pandya <hmp@FreeBSD.ORG> To: freebsd-arch@FreeBSD.ORG Subject: Using weak referencing for uuid routines Message-ID: <20030507083529.GA73613@perrin.int.nxad.com>
next in thread | raw e-mail | index | archive | help
--PmA2V3Z32TCmWXqI Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hello gang. I am sending a patch for changing the uuid part of libc to use weak referencing. This was originally requested by Alexander Kabaev <kan@FreeBSD.ORG>. If this patch is accepted, than I would like one of src committers to commit it for me. Cheers. -- Hiten (hmp@FreeBSD.ORG) --PmA2V3Z32TCmWXqI Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="uuid-weak-ref.patch" Index: lib/libc/uuid/uuid_compare.c =================================================================== RCS file: /home/ncvs/src/lib/libc/uuid/uuid_compare.c,v retrieving revision 1.1 diff -u -r1.1 uuid_compare.c --- lib/libc/uuid/uuid_compare.c 30 Oct 2002 03:51:00 -0000 1.1 +++ lib/libc/uuid/uuid_compare.c 6 May 2003 17:27:21 -0000 @@ -40,7 +40,7 @@ * than any non-nil UUID. */ int32_t -uuid_compare(uuid_t *a, uuid_t *b, uint32_t *status) +__uuid_compare(uuid_t *a, uuid_t *b, uint32_t *status) { int res; @@ -74,3 +74,5 @@ return ((res < 0) ? -1 : 1); return (memcmp(a->node, b->node, sizeof(uuid_t))); } + +__weak_reference(__uuid_compare, uuid_compare); Index: lib/libc/uuid/uuid_create.c =================================================================== RCS file: /home/ncvs/src/lib/libc/uuid/uuid_create.c,v retrieving revision 1.1 diff -u -r1.1 uuid_create.c --- lib/libc/uuid/uuid_create.c 30 Oct 2002 03:51:00 -0000 1.1 +++ lib/libc/uuid/uuid_create.c 6 May 2003 17:29:24 -0000 @@ -36,7 +36,7 @@ * http://www.transarc.ibm.com/Library/documentation/dce/1.1/uuid_create.html */ void -uuid_create(uuid_t *u, uint32_t *status) +__uuid_create(uuid_t *u, uint32_t *status) { if (status) @@ -44,3 +44,5 @@ uuidgen(u, 1); } + +__weak_reference(__uuid_create, uuid_create); Index: lib/libc/uuid/uuid_create_nil.c =================================================================== RCS file: /home/ncvs/src/lib/libc/uuid/uuid_create_nil.c,v retrieving revision 1.1 diff -u -r1.1 uuid_create_nil.c --- lib/libc/uuid/uuid_create_nil.c 30 Oct 2002 03:51:00 -0000 1.1 +++ lib/libc/uuid/uuid_create_nil.c 6 May 2003 17:30:15 -0000 @@ -37,7 +37,7 @@ * http://www.transarc.ibm.com/Library/documentation/dce/1.1/uuid_create_nil.html */ void -uuid_create_nil(uuid_t *u, uint32_t *status) +__uuid_create_nil(uuid_t *u, uint32_t *status) { if (status) @@ -45,3 +45,5 @@ bzero(u, sizeof(*u)); } + +__weak_reference(__uuid_create_nil, uuid_create_nil); Index: lib/libc/uuid/uuid_equal.c =================================================================== RCS file: /home/ncvs/src/lib/libc/uuid/uuid_equal.c,v retrieving revision 1.1 diff -u -r1.1 uuid_equal.c --- lib/libc/uuid/uuid_equal.c 30 Oct 2002 03:51:00 -0000 1.1 +++ lib/libc/uuid/uuid_equal.c 6 May 2003 17:27:01 -0000 @@ -37,7 +37,7 @@ * http://www.transarc.ibm.com/Library/documentation/dce/1.1/uuid_equal.html */ int32_t -uuid_equal(uuid_t *a, uuid_t *b, uint32_t *status) +__uuid_equal(uuid_t *a, uuid_t *b, uint32_t *status) { if (status != NULL) @@ -54,3 +54,5 @@ /* Do a byte for byte comparison. */ return ((memcmp(a, b, sizeof(uuid_t))) ? 0 : 1); } + +__weak_reference(__uuid_equal, uuid_equal); Index: lib/libc/uuid/uuid_from_string.c =================================================================== RCS file: /home/ncvs/src/lib/libc/uuid/uuid_from_string.c,v retrieving revision 1.1 diff -u -r1.1 uuid_from_string.c --- lib/libc/uuid/uuid_from_string.c 30 Oct 2002 03:51:00 -0000 1.1 +++ lib/libc/uuid/uuid_from_string.c 6 May 2003 17:27:40 -0000 @@ -42,7 +42,7 @@ * native byte order. */ void -uuid_from_string(const char *s, uuid_t *u, uint32_t *status) +__uuid_from_string(const char *s, uuid_t *u, uint32_t *status) { int n; @@ -91,3 +91,5 @@ *status = uuid_s_ok; } } + +__weak_reference(__uuid_from_string, uuid_from_string); Index: lib/libc/uuid/uuid_hash.c =================================================================== RCS file: /home/ncvs/src/lib/libc/uuid/uuid_hash.c,v retrieving revision 1.1 diff -u -r1.1 uuid_hash.c --- lib/libc/uuid/uuid_hash.c 30 Oct 2002 03:51:00 -0000 1.1 +++ lib/libc/uuid/uuid_hash.c 6 May 2003 17:28:17 -0000 @@ -36,7 +36,7 @@ * http://www.transarc.ibm.com/Library/documentation/dce/1.1/uuid_hash.html */ uint16_t -uuid_hash(uuid_t *u, uint32_t *status) +__uuid_hash(uuid_t *u, uint32_t *status) { if (status) @@ -48,3 +48,5 @@ */ return ((u) ? u->time_low & 0xffff : 0); } + +__weak_reference(__uuid_hash, uuid_hash); Index: lib/libc/uuid/uuid_is_nil.c =================================================================== RCS file: /home/ncvs/src/lib/libc/uuid/uuid_is_nil.c,v retrieving revision 1.1 diff -u -r1.1 uuid_is_nil.c --- lib/libc/uuid/uuid_is_nil.c 30 Oct 2002 03:51:00 -0000 1.1 +++ lib/libc/uuid/uuid_is_nil.c 6 May 2003 17:28:36 -0000 @@ -36,7 +36,7 @@ * http://www.transarc.ibm.com/Library/documentation/dce/1.1/uuid_is_nil.html */ int32_t -uuid_is_nil(uuid_t *u, uint32_t *status) +__uuid_is_nil(uuid_t *u, uint32_t *status) { uint32_t *p; @@ -53,3 +53,5 @@ p = (uint32_t*)u; return ((p[0] == 0 && p[1] == 0 && p[2] == 0 && p[3] == 0) ? 1 : 0); } + +__weak_reference(__uuid_is_nil, uuid_is_nil); Index: lib/libc/uuid/uuid_to_string.c =================================================================== RCS file: /home/ncvs/src/lib/libc/uuid/uuid_to_string.c,v retrieving revision 1.1 diff -u -r1.1 uuid_to_string.c --- lib/libc/uuid/uuid_to_string.c 30 Oct 2002 03:51:00 -0000 1.1 +++ lib/libc/uuid/uuid_to_string.c 6 May 2003 17:28:00 -0000 @@ -42,7 +42,7 @@ * taken from the Hewlett-Packard implementation. */ void -uuid_to_string(uuid_t *u, char **s, uint32_t *status) +__uuid_to_string(uuid_t *u, char **s, uint32_t *status) { uuid_t nil; @@ -66,3 +66,5 @@ if (*s == NULL && status != NULL) *status = uuid_s_no_memory; } + +__weak_reference(__uuid_to_string, uuid_to_string); --PmA2V3Z32TCmWXqI--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030507083529.GA73613>