diff --git a/ChangeLog b/ChangeLog index 596cd3ec..6b0cd7f6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 1998-06-18 Martin Baulig + * 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. diff --git a/include/glibtop/xmalloc.h b/include/glibtop/xmalloc.h index 5c2b5024..4a67212d 100644 --- a/include/glibtop/xmalloc.h +++ b/include/glibtop/xmalloc.h @@ -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 diff --git a/sysdeps/common/xmalloc.c b/sysdeps/common/xmalloc.c index fec5b99f..54b48eaa 100644 --- a/sysdeps/common/xmalloc.c +++ b/sysdeps/common/xmalloc.c @@ -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) {