New function.

1998-06-18  Martin Baulig  <baulig@taurus.uni-trier.de>

	* lib/xmalloc.c (glibtop_strdup_r): New function.
This commit is contained in:
Martin Baulig
1998-06-18 13:06:40 +00:00
committed by Martin Baulig
parent 8b025ff2c2
commit 81c75477f4
3 changed files with 12 additions and 0 deletions

View File

@@ -1,5 +1,9 @@
1998-06-18 Martin Baulig <baulig@taurus.uni-trier.de>
* lib/xmalloc.c (glibtop_strdup_r): New function.
* lib/gnuclient.c: Removed.
* lib/{command, write, read}.c: Changed client <-> server
interface to make less system calls.

View File

@@ -30,11 +30,13 @@ __BEGIN_DECLS
#define glibtop_malloc(p1) glibtop_malloc_r(glibtop_global_server, p1)
#define glibtop_calloc(p1, p2) glibtop_calloc_r(glibtop_global_server, p1, p2)
#define glibtop_realloc(p1, p2) glibtop_realloc_r(glibtop_global_server, p1, p2)
#define glibtop_strdup(p2) glibtop_strdup_r(glibtop_global_server, p1)
#define glibtop_free(p1) glibtop_free_r(glibtop_global_server, p1)
extern void *glibtop_malloc_r __P((glibtop *, size_t));
extern void *glibtop_calloc_r __P((glibtop *, size_t, size_t));
extern void *glibtop_realloc_r __P((glibtop *, void *, size_t));
extern char *glibtop_strdup_r __P((glibtop *, const char *));
extern void glibtop_free_r __P((glibtop *, void *));
__END_DECLS

View File

@@ -59,6 +59,12 @@ glibtop_realloc_r (glibtop *server, void *ptr, size_t size)
return buf;
}
char *
glibtop_strdup_r (glibtop *server, const char *string)
{
return strcpy (glibtop_malloc_r (server, strlen (string) + 1), string);
}
void
glibtop_free_r (glibtop *server, void *ptr)
{