xfree: move xfree() function to xmalloc.c
Signed-off-by: whzhe <wanghongzhe@huawei.com>
This commit is contained in:
parent
18c5c6139d
commit
e24700fd5d
@ -448,6 +448,7 @@ extern bool valid (const char *, const struct passwd *);
|
||||
extern /*@maynotreturn@*/ /*@only@*//*@out@*//*@notnull@*/char *xmalloc (size_t size)
|
||||
/*@ensures MaxSet(result) == (size - 1); @*/;
|
||||
extern /*@maynotreturn@*/ /*@only@*//*@notnull@*/char *xstrdup (const char *);
|
||||
extern void xfree(void *ap);
|
||||
|
||||
/* xgetpwnam.c */
|
||||
extern /*@null@*/ /*@only@*/struct passwd *xgetpwnam (const char *);
|
||||
|
@ -66,3 +66,10 @@
|
||||
{
|
||||
return strcpy (xmalloc (strlen (str) + 1), str);
|
||||
}
|
||||
|
||||
void xfree(void *ap)
|
||||
{
|
||||
if (ap) {
|
||||
free(ap);
|
||||
}
|
||||
}
|
||||
|
@ -123,12 +123,6 @@ static void log_gpasswd_success (const char *suffix);
|
||||
static void log_gpasswd_success_system (/*@null@*/unused void *arg);
|
||||
static void log_gpasswd_success_group (/*@null@*/unused void *arg);
|
||||
|
||||
static void xfree(void* p) {
|
||||
if (p) {
|
||||
free(p);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* usage - display usage message
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user