mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-30 22:43:12 +03:00
Update.
1999-05-14 Ulrich Drepper <drepper@cygnus.com> * nss/getXXbyYY.c: Add free_mem function which disposes all statically allocated memory when debugging. * nss/getXXent.c: Likewise. * nss/nsswitch.c: Likewise.
This commit is contained in:
@ -1,3 +1,10 @@
|
|||||||
|
1999-05-14 Ulrich Drepper <drepper@cygnus.com>
|
||||||
|
|
||||||
|
* nss/getXXbyYY.c: Add free_mem function which disposes all
|
||||||
|
statically allocated memory when debugging.
|
||||||
|
* nss/getXXent.c: Likewise.
|
||||||
|
* nss/nsswitch.c: Likewise.
|
||||||
|
|
||||||
1999-05-13 Ulrich Drepper <drepper@cygnus.com>
|
1999-05-13 Ulrich Drepper <drepper@cygnus.com>
|
||||||
|
|
||||||
* sysdeps/gnu/getutmpx.c: New file.
|
* sysdeps/gnu/getutmpx.c: New file.
|
||||||
|
@ -72,11 +72,13 @@ extern int INTERNAL (REENTRANT_NAME) (ADD_PARAMS, LOOKUP_TYPE *resbuf,
|
|||||||
/* We need to protect the dynamic buffer handling. */
|
/* We need to protect the dynamic buffer handling. */
|
||||||
__libc_lock_define_initialized (static, lock);
|
__libc_lock_define_initialized (static, lock);
|
||||||
|
|
||||||
|
/* This points to the static buffer used. */
|
||||||
|
static char *buffer;
|
||||||
|
|
||||||
|
|
||||||
LOOKUP_TYPE *
|
LOOKUP_TYPE *
|
||||||
FUNCTION_NAME (ADD_PARAMS)
|
FUNCTION_NAME (ADD_PARAMS)
|
||||||
{
|
{
|
||||||
static char *buffer;
|
|
||||||
static size_t buffer_size;
|
static size_t buffer_size;
|
||||||
static LOOKUP_TYPE resbuf;
|
static LOOKUP_TYPE resbuf;
|
||||||
LOOKUP_TYPE *result;
|
LOOKUP_TYPE *result;
|
||||||
@ -151,3 +153,14 @@ done:
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Free all resources if necessary. */
|
||||||
|
static void __attribute__ ((unused))
|
||||||
|
free_mem (void)
|
||||||
|
{
|
||||||
|
if (buffer != NULL)
|
||||||
|
free (buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
text_set_element (__libc_subfreeres, free_mem);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
/* Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
@ -62,11 +62,13 @@ extern int INTERNAL (REENTRANT_GETNAME) (LOOKUP_TYPE *resbuf, char *buffer,
|
|||||||
/* We need to protect the dynamic buffer handling. */
|
/* We need to protect the dynamic buffer handling. */
|
||||||
__libc_lock_define_initialized (static, lock);
|
__libc_lock_define_initialized (static, lock);
|
||||||
|
|
||||||
|
/* This points to the static buffer used. */
|
||||||
|
static char *buffer;
|
||||||
|
|
||||||
|
|
||||||
LOOKUP_TYPE *
|
LOOKUP_TYPE *
|
||||||
GETFUNC_NAME (void)
|
GETFUNC_NAME (void)
|
||||||
{
|
{
|
||||||
static char *buffer;
|
|
||||||
static size_t buffer_size;
|
static size_t buffer_size;
|
||||||
static LOOKUP_TYPE resbuf;
|
static LOOKUP_TYPE resbuf;
|
||||||
LOOKUP_TYPE *result;
|
LOOKUP_TYPE *result;
|
||||||
@ -113,3 +115,14 @@ GETFUNC_NAME (void)
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Free all resources if necessary. */
|
||||||
|
static void __attribute__ ((unused))
|
||||||
|
free_mem (void)
|
||||||
|
{
|
||||||
|
if (buffer != NULL)
|
||||||
|
free (buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
text_set_element (__libc_subfreeres, free_mem);
|
||||||
|
@ -753,3 +753,62 @@ nss_new_service (name_database *database, const char *name)
|
|||||||
|
|
||||||
return *currentp;
|
return *currentp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
nothing (void *ptr __attribute__ ((unused)))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Free all resources if necessary. */
|
||||||
|
static void __attribute__ ((unused))
|
||||||
|
free_mem (void)
|
||||||
|
{
|
||||||
|
name_database *top = service_table;
|
||||||
|
name_database_entry *entry;
|
||||||
|
service_library *library;
|
||||||
|
|
||||||
|
if (top == NULL)
|
||||||
|
/* Maybe we have not read the nsswitch.conf file. */
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* Don't disturb ongoing other threads (if there are any). */
|
||||||
|
service_table = NULL;
|
||||||
|
|
||||||
|
entry = top->entry;
|
||||||
|
while (entry != NULL)
|
||||||
|
{
|
||||||
|
name_database_entry *olde = entry;
|
||||||
|
service_user *service = entry->service;
|
||||||
|
|
||||||
|
while (service != NULL)
|
||||||
|
{
|
||||||
|
service_user *olds = service;
|
||||||
|
|
||||||
|
if (service->known != NULL)
|
||||||
|
__tdestroy (service->known, nothing);
|
||||||
|
|
||||||
|
service = service->next;
|
||||||
|
free (olds);
|
||||||
|
}
|
||||||
|
|
||||||
|
entry = entry->next;
|
||||||
|
free (olde);
|
||||||
|
}
|
||||||
|
|
||||||
|
library = top->library;
|
||||||
|
while (library != NULL)
|
||||||
|
{
|
||||||
|
service_library *oldl = library;
|
||||||
|
|
||||||
|
_dl_close (library->lib_handle);
|
||||||
|
|
||||||
|
library = library->next;
|
||||||
|
free (oldl);
|
||||||
|
}
|
||||||
|
|
||||||
|
free (top);
|
||||||
|
}
|
||||||
|
|
||||||
|
text_set_element (__libc_subfreeres, free_mem);
|
||||||
|
@ -19,7 +19,10 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <utmp.h>
|
#include <utmp.h>
|
||||||
|
/* This is an ugly hack but we must not see the getutmpx declaration. */
|
||||||
|
#define getutmpx XXXgetutmpx
|
||||||
#include <utmpx.h>
|
#include <utmpx.h>
|
||||||
|
#undef getutmpx
|
||||||
|
|
||||||
void
|
void
|
||||||
getutmp (const struct utmpx *utmpx, struct utmp *utmp)
|
getutmp (const struct utmpx *utmpx, struct utmp *utmp)
|
||||||
|
Reference in New Issue
Block a user