2003-01-19  Ulrich Drepper  <drepper@redhat.com>

	* nis/nss_nis/nis-spwd.c: Make _nss_nis_endspent an alias of
	_nss_nis_setspent.  Work around the different prototypes.
	* nis/nss_nis/nis-rpc.c (internal_nis_setrpcent): Use
	internal_nis_endrpcent.
	(internal_nis_endrpcent): Change return type to void.  Change callers.
	* nis/nss_nis/nis-pwd.c: Make _nss_nis_endpwent an alias of
	_nss_nis_setpwent.  Work around the different prototypes.
	* nis/nss_nis/nis-proto.c (_nss_nis_endprotoent): Split out body
	of the function to...
	(internal_nis_endprotoent): ... here.  New function.
	(internal_nis_setprotoent): Use internal_nis_endprotoent.
	* nis/nss_nis/nis-network.c: Make _nss_nis_endnetent an alias of
	_nss_nis_setnetent.  Work around the different prototypes.
	* nis/nss_nis/nis-netgrp.c (_nss_nis_endnetgrent): Split out body
	of the function to...
	(internal_nis_endnetgrent): ... here.  New function.
	(_nss_nis_setnetgrent): Use internal_nis_endnetgrent.
This commit is contained in:
Ulrich Drepper 2003-01-19 19:22:02 +00:00
parent 978bd14399
commit b677d67428
8 changed files with 100 additions and 128 deletions

View File

@ -1,3 +1,23 @@
2003-01-19 Ulrich Drepper <drepper@redhat.com>
* nis/nss_nis/nis-spwd.c: Make _nss_nis_endspent an alias of
_nss_nis_setspent. Work around the different prototypes.
* nis/nss_nis/nis-rpc.c (internal_nis_setrpcent): Use
internal_nis_endrpcent.
(internal_nis_endrpcent): Change return type to void. Change callers.
* nis/nss_nis/nis-pwd.c: Make _nss_nis_endpwent an alias of
_nss_nis_setpwent. Work around the different prototypes.
* nis/nss_nis/nis-proto.c (_nss_nis_endprotoent): Split out body
of the function to...
(internal_nis_endprotoent): ... here. New function.
(internal_nis_setprotoent): Use internal_nis_endprotoent.
* nis/nss_nis/nis-network.c: Make _nss_nis_endnetent an alias of
_nss_nis_setnetent. Work around the different prototypes.
* nis/nss_nis/nis-netgrp.c (_nss_nis_endnetgrent): Split out body
of the function to...
(internal_nis_endnetgrent): ... here. New function.
(_nss_nis_setnetgrent): Use internal_nis_endnetgrent.
2003-01-19 Jim Meyering <jim@meyering.net>
* time/strftime.c: (widen): Merge nearly-identical definitions.

View File

@ -64,7 +64,7 @@ _nss_nis_setgrent (int stayopen)
}
/* Make _nss_nis_endgrent an alias of _nss_nis_setgrent. We do this
even though the prototypes don't match. The argument of setgrent
is used so this makes no difference. */
is not used so this makes no difference. */
strong_alias (_nss_nis_setgrent, _nss_nis_endgrent)
static enum nss_status

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1996, 1997, 1999, 2000, 2002 Free Software Foundation, Inc.
/* Copyright (C) 1996,1997,1999,2000,2002,2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1996.
@ -42,6 +42,19 @@ extern enum nss_status
_nss_netgroup_parseline (char **cursor, struct __netgrent *result,
char *buffer, size_t buflen, int *errnop);
static void
internal_nis_endnetgrent (void)
{
if (data != NULL)
{
free (data);
data = NULL;
data_size = 0;
cursor = NULL;
}
}
enum nss_status
_nss_nis_setnetgrent (const char *group, struct __netgrent *dummy)
{
@ -60,13 +73,7 @@ _nss_nis_setnetgrent (const char *group, struct __netgrent *dummy)
__libc_lock_lock (lock);
if (data != NULL)
{
free (data);
data = NULL;
data_size = 0;
cursor = NULL;
}
internal_nis_endnetgrent ();
group_len = strlen (group);
@ -96,13 +103,7 @@ _nss_nis_endnetgrent (struct __netgrent *dummy)
{
__libc_lock_lock (lock);
if (data != NULL)
{
free (data);
data = NULL;
data_size = 0;
cursor = NULL;
}
internal_nis_endnetgrent ();
__libc_lock_unlock (lock);

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1996-2000, 2001, 2002 Free Software Foundation, Inc.
/* Copyright (C) 1996-2000, 2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996.
@ -18,7 +18,11 @@
02111-1307 USA. */
#include <nss.h>
/* The following is an ugly trick to avoid a prototype declaration for
_nss_nis_endgrent. */
#define _nss_nis_endnetent _nss_nis_endnetent_XXX
#include <netdb.h>
#undef _nss_nis_endnetent
#include <ctype.h>
#include <errno.h>
#include <stdint.h>
@ -59,24 +63,10 @@ _nss_nis_setnetent (int stayopen)
return NSS_STATUS_SUCCESS;
}
enum nss_status
_nss_nis_endnetent (void)
{
__libc_lock_lock (lock);
new_start = 1;
if (oldkey != NULL)
{
free (oldkey);
oldkey = NULL;
oldkeylen = 0;
}
__libc_lock_unlock (lock);
return NSS_STATUS_SUCCESS;
}
/* Make _nss_nis_endnetent an alias of _nss_nis_setnetent. We do this
even though the prototypes don't match. The argument of setnetent
is not used so this makes no difference. */
strong_alias (_nss_nis_setnetent, _nss_nis_endnetent)
static enum nss_status
internal_nis_getnetent_r (struct netent *net, char *buffer, size_t buflen,

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1996,1997,1998,2000,2001,2002 Free Software Foundation, Inc.
/* Copyright (C) 1996-1998, 2000-2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1996.
@ -78,6 +78,19 @@ saveit (int instatus, char *inkey, int inkeylen, char *inval,
return 0;
}
static void
internal_nis_endprotoent (void)
{
while (start != NULL)
{
if (start->val != NULL)
free (start->val);
next = start;
start = start->next;
free (next);
}
}
static enum nss_status
internal_nis_setprotoent (void)
{
@ -87,15 +100,7 @@ internal_nis_setprotoent (void)
yp_get_default_domain (&domainname);
while (start != NULL)
{
if (start->val != NULL)
free (start->val);
next = start;
start = start->next;
free (next);
}
start = NULL;
internal_nis_endprotoent ();
ypcb.foreach = saveit;
ypcb.data = NULL;
@ -124,15 +129,7 @@ _nss_nis_endprotoent (void)
{
__libc_lock_lock (lock);
while (start != NULL)
{
if (start->val != NULL)
free (start->val);
next = start;
start = start->next;
free (next);
}
start = NULL;
internal_nis_endprotoent ();
next = NULL;
__libc_lock_unlock (lock);

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1996, 1997, 1998, 2001, 2002 Free Software Foundation, Inc.
/* Copyright (C) 1996-1998, 2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996.
@ -18,7 +18,11 @@
02111-1307 USA. */
#include <nss.h>
/* The following is an ugly trick to avoid a prototype declaration for
_nss_nis_endpwent. */
#define _nss_nis_endpwent _nss_nis_endpwent_XXX
#include <pwd.h>
#undef _nss_nis_endpwent
#include <ctype.h>
#include <errno.h>
#include <string.h>
@ -58,24 +62,10 @@ _nss_nis_setpwent (int stayopen)
return NSS_STATUS_SUCCESS;
}
enum nss_status
_nss_nis_endpwent (void)
{
__libc_lock_lock (lock);
new_start = 1;
if (oldkey != NULL)
{
free (oldkey);
oldkey = NULL;
oldkeylen = 0;
}
__libc_lock_unlock (lock);
return NSS_STATUS_SUCCESS;
}
/* Make _nss_nis_endpwent an alias of _nss_nis_setpwent. We do this
even though the prototypes don't match. The argument of setpwent
is not used so this makes no difference. */
strong_alias (_nss_nis_setpwent, _nss_nis_endpwent)
static enum nss_status
internal_nis_getpwent_r (struct passwd *pwd, char *buffer, size_t buflen,

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1996, 1997, 1998, 2000, 2002 Free Software Foundation, Inc.
/* Copyright (C) 1996-1998, 2000, 2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1996.
@ -86,6 +86,19 @@ saveit (int instatus, char *inkey, int inkeylen, char *inval,
return 0;
}
static void
internal_nis_endrpcent (intern_t *intern)
{
while (intern->start != NULL)
{
if (intern->start->val != NULL)
free (intern->start->val);
intern->next = intern->start;
intern->start = intern->start->next;
free (intern->next);
}
}
static enum nss_status
internal_nis_setrpcent (intern_t *intern)
{
@ -96,15 +109,7 @@ internal_nis_setrpcent (intern_t *intern)
if (yp_get_default_domain (&domainname))
return NSS_STATUS_UNAVAIL;
while (intern->start != NULL)
{
if (intern->start->val != NULL)
free (intern->start->val);
intern->next = intern->start;
intern->start = intern->start->next;
free (intern->next);
}
intern->start = NULL;
internal_nis_endrpcent (intern);
ypcb.foreach = saveit;
ypcb.data = (char *)intern;
@ -128,34 +133,16 @@ _nss_nis_setrpcent (int stayopen)
return status;
}
static enum nss_status
internal_nis_endrpcent (intern_t *intern)
{
while (intern->start != NULL)
{
if (intern->start->val != NULL)
free (intern->start->val);
intern->next = intern->start;
intern->start = intern->start->next;
free (intern->next);
}
intern->start = NULL;
return NSS_STATUS_SUCCESS;
}
enum nss_status
_nss_nis_endrpcent (void)
{
enum nss_status status;
__libc_lock_lock (lock);
status = internal_nis_endrpcent (&intern);
internal_nis_endrpcent (&intern);
__libc_lock_unlock (lock);
return status;
return NSS_STATUS_SUCCESS;
}
static enum nss_status

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1996, 1997, 1998, 2001, 2002 Free Software Foundation, Inc.
/* Copyright (C) 1996-1998, 2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996.
@ -21,7 +21,11 @@
#include <ctype.h>
#include <errno.h>
#include <string.h>
/* The following is an ugly trick to avoid a prototype declaration for
_nss_nis_endspent. */
#define _nss_nis_endspent _nss_nis_endspent_XXX
#include <shadow.h>
#undef _nss_nis_endspent
#include <bits/libc-lock.h>
#include <rpcsvc/yp.h>
#include <rpcsvc/ypclnt.h>
@ -47,35 +51,18 @@ _nss_nis_setspent (int stayopen)
__libc_lock_lock (lock);
new_start = 1;
if (oldkey != NULL)
{
free (oldkey);
oldkey = NULL;
oldkeylen = 0;
}
__libc_lock_unlock (lock);
return NSS_STATUS_SUCCESS;
}
enum nss_status
_nss_nis_endspent (void)
{
__libc_lock_lock (lock);
new_start = 1;
if (oldkey != NULL)
{
free (oldkey);
oldkey = NULL;
oldkeylen = 0;
}
free (oldkey);
oldkey = NULL;
oldkeylen = 0;
__libc_lock_unlock (lock);
return NSS_STATUS_SUCCESS;
}
/* Make _nss_nis_endspent an alias of _nss_nis_setspent. We do this
even though the prototypes don't match. The argument of setspent
is not used so this makes no difference. */
strong_alias (_nss_nis_setspent, _nss_nis_endspent)
static enum nss_status
internal_nis_getspent_r (struct spwd *sp, char *buffer, size_t buflen,