This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.
Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Here's a fix to get rid of a number of these warnings. Ok to commit? Andreas 2002-11-10 Andreas Jaeger <aj@suse.de> * nss/getXXent.c (GETFUNC_NAME): Use union type to avoid strict aliasing problem. * nss/getXXbyYY_r.c (INTERNAL): Likewise. * nss/getnssent_r.c (__nss_getent_r): Likewise. (__nss_setent): Likewise. (__nss_getent_r): Likewise. ============================================================ Index: nss/getXXent.c --- nss/getXXent.c 1 Nov 2002 20:43:39 -0000 1.14 +++ nss/getXXent.c 10 Nov 2002 09:50:49 -0000 @@ -70,7 +70,12 @@ LOOKUP_TYPE * GETFUNC_NAME (void) { static size_t buffer_size; - static LOOKUP_TYPE resbuf; + static union + { + LOOKUP_TYPE l; + void *ptr; + } resbuf; + LOOKUP_TYPE *result; int save; @@ -79,7 +84,7 @@ GETFUNC_NAME (void) result = (LOOKUP_TYPE *) __nss_getent ((getent_r_function) INTERNAL (REENTRANT_GETNAME), - (void **) &resbuf, &buffer, BUFLEN, &buffer_size, + &resbuf.ptr, &buffer, BUFLEN, &buffer_size, H_ERRNO_VAR); save = errno; ============================================================ Index: nss/getXXbyYY_r.c --- nss/getXXbyYY_r.c 12 Sep 2002 05:14:59 -0000 1.47 +++ nss/getXXbyYY_r.c 10 Nov 2002 09:50:49 -0000 @@ -130,7 +130,12 @@ INTERNAL (REENTRANT_NAME) (ADD_PARAMS, L static service_user *startp; static lookup_function start_fct; service_user *nip; - lookup_function fct; + union + { + lookup_function l; + void *ptr; + } fct; + int no_more; enum nss_status status = NSS_STATUS_UNAVAIL; #ifdef USE_NSCD @@ -175,13 +180,13 @@ INTERNAL (REENTRANT_NAME) (ADD_PARAMS, L if (startp == NULL) { - no_more = DB_LOOKUP_FCT (&nip, REENTRANT_NAME_STRING, (void **) &fct); + no_more = DB_LOOKUP_FCT (&nip, REENTRANT_NAME_STRING, &fct.ptr); if (no_more) startp = (service_user *) -1l; else { startp = nip; - start_fct = fct; + start_fct = fct.l; #ifdef NEED__RES /* The resolver code will really be used so we have to @@ -201,7 +206,7 @@ INTERNAL (REENTRANT_NAME) (ADD_PARAMS, L } else { - fct = start_fct; + fct.l = start_fct; no_more = (nip = startp) == (service_user *) -1l; } @@ -211,7 +216,7 @@ INTERNAL (REENTRANT_NAME) (ADD_PARAMS, L any_service = true; #endif - status = DL_CALL_FCT (fct, (ADD_VARIABLES, resbuf, buffer, buflen, + status = DL_CALL_FCT (fct.l, (ADD_VARIABLES, resbuf, buffer, buflen, &errno H_ERRNO_VAR)); /* The status is NSS_STATUS_TRYAGAIN and errno is ERANGE the @@ -227,7 +232,7 @@ INTERNAL (REENTRANT_NAME) (ADD_PARAMS, L break; no_more = __nss_next (&nip, REENTRANT_NAME_STRING, - (void **) &fct, status, 0); + &fct.ptr, status, 0); } #ifdef HANDLE_DIGITS_DOTS ============================================================ Index: nss/getnssent_r.c --- nss/getnssent_r.c 12 Sep 2002 02:58:21 -0000 1.4 +++ nss/getnssent_r.c 10 Nov 2002 09:50:49 -0000 @@ -53,7 +53,11 @@ __nss_setent (const char *func_name, db_ service_user **last_nip, int stayopen, int *stayopen_tmp, int res) { - setent_function fct; + union + { + setent_function f; + void *ptr; + } fct; int no_more; if (res && (_res.options & RES_INIT) == 0 @@ -65,7 +69,7 @@ __nss_setent (const char *func_name, db_ /* Cycle through the services and run their `setXXent' functions until we find an available service. */ - no_more = setup (func_name, lookup_fct, (void **) &fct, nip, + no_more = setup (func_name, lookup_fct, &fct.ptr, nip, startp, 1); while (! no_more) { @@ -73,11 +77,11 @@ __nss_setent (const char *func_name, db_ enum nss_status status; if (stayopen_tmp) - status = DL_CALL_FCT (fct, (*stayopen_tmp)); + status = DL_CALL_FCT (fct.f, (*stayopen_tmp)); else - status = DL_CALL_FCT (fct, (0)); + status = DL_CALL_FCT (fct.f, (0)); - no_more = __nss_next (nip, func_name, (void **) &fct, + no_more = __nss_next (nip, func_name, &fct.ptr, status, 0); if (is_last_nip) *last_nip = *nip; @@ -93,7 +97,11 @@ __nss_endent (const char *func_name, db_ service_user **nip, service_user **startp, service_user **last_nip, int res) { - endent_function fct; + union + { + endent_function f; + void *ptr; + } fct; int no_more; if (res && (_res.options & RES_INIT) == 0 @@ -104,17 +112,17 @@ __nss_endent (const char *func_name, db_ } /* Cycle through all the services and run their endXXent functions. */ - no_more = setup (func_name, lookup_fct, (void **) &fct, nip, startp, 1); + no_more = setup (func_name, lookup_fct, &fct.ptr, nip, startp, 1); while (! no_more) { /* Ignore status, we force check in __NSS_NEXT. */ - DL_CALL_FCT (fct, ()); + DL_CALL_FCT (fct.f, ()); if (*nip == *last_nip) /* We have processed all services which were used. */ break; - no_more = __nss_next (nip, func_name, (void **) &fct, 0, 1); + no_more = __nss_next (nip, func_name, &fct.ptr, 0, 1); } *last_nip = *nip = NULL; } @@ -129,7 +137,11 @@ __nss_getent_r (const char *getent_func_ void *resbuf, char *buffer, size_t buflen, void **result, int *h_errnop) { - getent_function fct; + union + { + getent_function f; + void *ptr; + } fct; int no_more; enum nss_status status; @@ -147,13 +159,13 @@ __nss_getent_r (const char *getent_func_ /* Run through available functions, starting with the same function last run. We will repeat each function as long as it succeeds, and then go on to the next service action. */ - no_more = setup (getent_func_name, lookup_fct, (void **) &fct, nip, + no_more = setup (getent_func_name, lookup_fct, &fct.ptr, nip, startp, 0); while (! no_more) { int is_last_nip = *nip == *last_nip; - status = DL_CALL_FCT (fct, + status = DL_CALL_FCT (fct.f, (resbuf, buffer, buflen, &errno, &h_errno)); /* The the status is NSS_STATUS_TRYAGAIN and errno is ERANGE the @@ -168,7 +180,7 @@ __nss_getent_r (const char *getent_func_ do { - no_more = __nss_next (nip, getent_func_name, (void **) &fct, + no_more = __nss_next (nip, getent_func_name, &fct.ptr, status, 0); if (is_last_nip) @@ -177,17 +189,21 @@ __nss_getent_r (const char *getent_func_ if (! no_more) { /* Call the `setXXent' function. This wasn't done before. */ - setent_function sfct; + union + { + setent_function f; + void *ptr; + } sfct; no_more = __nss_lookup (nip, setent_func_name, - (void **) &sfct); + &sfct.ptr); if (! no_more) { if (stayopen_tmp) - status = DL_CALL_FCT (sfct, (*stayopen_tmp)); + status = DL_CALL_FCT (sfct.f, (*stayopen_tmp)); else - status = DL_CALL_FCT (sfct, (0)); + status = DL_CALL_FCT (sfct.f, (0)); } else status = NSS_STATUS_NOTFOUND; -- Andreas Jaeger SuSE Labs aj@suse.de private aj@arthur.inka.de http://www.suse.de/~aj
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |