gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r5798 - in flightrecorder/src: flightrecorderd include libf


From: gnunet
Subject: [GNUnet-SVN] r5798 - in flightrecorder/src: flightrecorderd include libflightrecorder
Date: Wed, 5 Dec 2007 14:19:09 -0700 (MST)

Author: durner
Date: 2007-12-05 14:19:09 -0700 (Wed, 05 Dec 2007)
New Revision: 5798

Removed:
   flightrecorder/src/include/xmalloc.h
Modified:
   flightrecorder/src/flightrecorderd/flightrecorder.c
   flightrecorder/src/include/Makefile.am
   flightrecorder/src/include/flightrecorder.h
   flightrecorder/src/libflightrecorder/main.c
   flightrecorder/src/libflightrecorder/stack_trace.c
   flightrecorder/src/libflightrecorder/xmalloc.c
Log:
fr_malloc()

Modified: flightrecorder/src/flightrecorderd/flightrecorder.c
===================================================================
--- flightrecorder/src/flightrecorderd/flightrecorder.c 2007-12-05 19:46:16 UTC 
(rev 5797)
+++ flightrecorder/src/flightrecorderd/flightrecorder.c 2007-12-05 21:19:09 UTC 
(rev 5798)
@@ -26,11 +26,6 @@
 
 #define EXIT_FAILURE 1
 
-char *xmalloc ();
-char *xrealloc ();
-char *xstrdup ();
-
-
 static void usage (int status);
 
 /* The name the program was run with, stripped of any leading path. */

Modified: flightrecorder/src/include/Makefile.am
===================================================================
--- flightrecorder/src/include/Makefile.am      2007-12-05 19:46:16 UTC (rev 
5797)
+++ flightrecorder/src/include/Makefile.am      2007-12-05 21:19:09 UTC (rev 
5798)
@@ -1 +1 @@
-EXTRA_DIST=sytem.h xmalloc.h
\ No newline at end of file
+EXTRA_DIST=sytem.h
\ No newline at end of file

Modified: flightrecorder/src/include/flightrecorder.h
===================================================================
--- flightrecorder/src/include/flightrecorder.h 2007-12-05 19:46:16 UTC (rev 
5797)
+++ flightrecorder/src/include/flightrecorder.h 2007-12-05 21:19:09 UTC (rev 
5798)
@@ -39,4 +39,10 @@
   unsigned int tid;
 } StackTrace;
 
+void *fr_malloc (size_t n);
+void *fr_calloc (size_t n, size_t s);
+void *fr_realloc (VOID *p, size_t n);
+char *fr_strdup (char *p);
+
+
 #endif /*FLIGHTRECORDER_H_*/

Deleted: flightrecorder/src/include/xmalloc.h
===================================================================
--- flightrecorder/src/include/xmalloc.h        2007-12-05 19:46:16 UTC (rev 
5797)
+++ flightrecorder/src/include/xmalloc.h        2007-12-05 21:19:09 UTC (rev 
5798)
@@ -1,6 +0,0 @@
-/* Prototypes for functions defined in xmalloc.c  */
-
-VOID *xmalloc (size_t n);
-VOID *xcalloc (size_t n, size_t s);
-VOID *xrealloc (VOID *p, size_t n);
-char *xstrdup (char *p);

Modified: flightrecorder/src/libflightrecorder/main.c
===================================================================
--- flightrecorder/src/libflightrecorder/main.c 2007-12-05 19:46:16 UTC (rev 
5797)
+++ flightrecorder/src/libflightrecorder/main.c 2007-12-05 21:19:09 UTC (rev 
5798)
@@ -44,11 +44,11 @@
 {
   if (!sessions)
   {
-    sessions = MALLOC(sizeof(Session));
+    sessions = fr_malloc(sizeof(Session));
     session_count = 1;
   }
   else
-    sessions = REALLOC(++session_count * sizeof(Session));
+    sessions = fr_realloc(++session_count * sizeof(Session));
     
   if (! sessions)
     return 0;

Modified: flightrecorder/src/libflightrecorder/stack_trace.c
===================================================================
--- flightrecorder/src/libflightrecorder/stack_trace.c  2007-12-05 19:46:16 UTC 
(rev 5797)
+++ flightrecorder/src/libflightrecorder/stack_trace.c  2007-12-05 21:19:09 UTC 
(rev 5798)
@@ -33,7 +33,7 @@
 
   if (!threads)
   {
-    traces = (StackTrace *) MALLOC(sizeof(StackTrace));
+    traces = (StackTrace *) fr_malloc(sizeof(StackTrace));
     threads++;
     
     return traces;
@@ -48,7 +48,7 @@
       trace++;
   }
   
-  traces = (StackTrace *) REALLOC(traces, ++threads * sizeof(StackTrace));
+  traces = (StackTrace *) fr_realloc(traces, ++threads * sizeof(StackTrace));
     
   if (!traces)
     return NULL;
@@ -88,9 +88,9 @@
     return 0;
 
   if (trace->depth == 0)
-    trace->entries = (StackTraceEntry *) MALLOC(sizeof(StackTraceEntry));
+    trace->entries = (StackTraceEntry *) fr_malloc(sizeof(StackTraceEntry));
   else
-    trace->entries = (StackTraceEntry *) REALLOC(trace->entries, (trace->depth 
+ 1) * sizeof(StrackTraceEntry));
+    trace->entries = (StackTraceEntry *) fr_realloc(trace->entries, 
(trace->depth + 1) * sizeof(StrackTraceEntry));
   if (!trace->entries)
     return 0;
   
@@ -127,15 +127,15 @@
     
     entry = trace->entries + trace->depth - 1;
     for(idx = 0; idx < entry->info_count; idx++)
-      FREE(entry->info[idx]);
+      fr_free(entry->info[idx]);
     
-    trace->entries = (StackTraceEntry *) REALLOC(trace->entries, 
--trace->depth * sizeof(StackTraceEntry));
+    trace->entries = (StackTraceEntry *) fr_realloc(trace->entries, 
--trace->depth * sizeof(StackTraceEntry));
     if (!trace->entries)
       return 0;
   }
   else
   {
-      FREE(trace->entries);
+      fr_free(trace->entries);
       trace->entries = NULL;
   }
     
@@ -158,9 +158,9 @@
 
   entry = trace->entries + trace->depth - 1;
   if (entry->info_count)
-    entry->info = (char **) REALLOC(entry->info, (entry->info_count + 1) * 
sizeof(char *));
+    entry->info = (char **) fr_realloc(entry->info, (entry->info_count + 1) * 
sizeof(char *));
   else
-    entry->info = (char **) MALLOC(sizeof(char *));
+    entry->info = (char **) fr_malloc(sizeof(char *));
   
   if (!entry->info)
     return 0;
@@ -189,7 +189,7 @@
   unsigned int idx;
   unsigned int *ret;
   
-  ret = MALLOC(threads * sizeof(unsigned int));
+  ret = fr_malloc(threads * sizeof(unsigned int));
   if (!ret)
     return NULL;
   

Modified: flightrecorder/src/libflightrecorder/xmalloc.c
===================================================================
--- flightrecorder/src/libflightrecorder/xmalloc.c      2007-12-05 19:46:16 UTC 
(rev 5797)
+++ flightrecorder/src/libflightrecorder/xmalloc.c      2007-12-05 21:19:09 UTC 
(rev 5798)
@@ -19,12 +19,6 @@
 # include <config.h>
 #endif
 
-#if __STDC__
-# define VOID void
-#else
-# define VOID char
-#endif
-
 #include <stdio.h>             /* for stderr */
 
 #if STDC_HEADERS
@@ -38,9 +32,9 @@
 extern size_t strlen ();
 extern char *strcpy ();
 
-VOID *calloc ();
-VOID *malloc ();
-VOID *realloc ();
+void *calloc ();
+void *malloc ();
+void *realloc ();
 void free ();
 #endif
 
@@ -56,19 +50,19 @@
 
 /* Prototypes for functions defined here.  */
 #if defined (__STDC__) && __STDC__
-static VOID *fixup_null_alloc (size_t n);
-VOID *xmalloc (size_t n);
-VOID *xcalloc (size_t n, size_t s);
-VOID *xrealloc (VOID *p, size_t n);
-char *xstrdup (char *p);
+static void *fixup_null_alloc (size_t n);
+void *fr_malloc (size_t n);
+void *fr_calloc (size_t n, size_t s);
+void *fr_realloc (void *p, size_t n);
+char *fr_strdup (char *p);
 #endif
 
 
-static VOID *
+static void *
 fixup_null_alloc (n)
      size_t n;
 {
-  VOID *p;
+  void *p;
 
   p = 0;
   if (n == 0)
@@ -78,18 +72,17 @@
       /* possible revisions: release some memory and re-try, print
         more information (e.g. line number of input file) */
       fprintf(stderr, _("flightrecorder: Memory exhausted"));
-      exit(1);
     }
   return p;
 }
 
 /* Allocate N bytes of memory dynamically, with error checking.  */
 
-VOID *
-xmalloc (n)
+void *
+fr_malloc (n)
      size_t n;
 {
-  VOID *p;
+  void *p;
 
   p = malloc (n);
   if (p == 0)
@@ -99,11 +92,11 @@
 
 /* Allocate memory for N elements of S bytes, with error checking.  */
 
-VOID *
-xcalloc (n, s)
+void *
+fr_calloc (n, s)
      size_t n, s;
 {
-  VOID *p;
+  void *p;
 
   p = calloc (n, s);
   if (p == 0)
@@ -115,9 +108,9 @@
    with error checking.
    If P is NULL, run xmalloc.  */
 
-VOID *
-xrealloc (p, n)
-     VOID *p;
+void *
+fr_realloc (p, n)
+     void *p;
      size_t n;
 {
   if (p == 0)
@@ -131,10 +124,10 @@
 /* Make a copy of a string in a newly allocated block of memory. */
 
 char *
-xstrdup (str)
+fr_strdup (str)
      char *str;
 {
-  VOID *p;
+  void *p;
 
   p = xmalloc (strlen (str) + 1);
   strcpy (p, str);





reply via email to

[Prev in Thread] Current Thread [Next in Thread]