ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/memory.c
(Generate patch)

Comparing:
ircd-hybrid/src/memory.c (file contents), Revision 33 by knight, Sun Oct 2 20:50:00 2005 UTC vs.
ircd-hybrid-8/src/memory.c (file contents), Revision 1309 by michael, Sun Mar 25 11:24:18 2012 UTC

# Line 25 | Line 25
25  
26   #include "stdinc.h"
27   #include "ircd_defs.h"
28 #include "ircd.h"
28   #include "irc_string.h"
29   #include "memory.h"
30 < #include "list.h"
32 < #include "client.h"
33 < #include "send.h"
34 < #include "tools.h"
35 < #include "s_log.h"
30 > #include "log.h"
31   #include "restart.h"
32  
33  
# Line 46 | Line 41 | MyMalloc(size_t size)
41  
42    if (ret == NULL)
43      outofmemory();
44 <  return(ret);
44 >
45 >  return ret;
46   }
47  
48   /*
# Line 59 | Line 55 | MyRealloc(void *x, size_t y)
55  
56    if (ret == NULL)
57      outofmemory();
58 <  return(ret);
58 >
59 >  return ret;
60   }
61  
62   void
# Line 88 | Line 85 | outofmemory(void)
85   {
86    static int was_here = 0;
87  
88 <  if (was_here)
88 >  if (was_here++)
89      abort();
90  
91 <  was_here = 1;
95 <
96 <  ilog(L_CRIT, "Out of memory: restarting server...");
91 >  ilog(LOG_TYPE_IRCD, "Out of memory: restarting server...");
92    restart("Out of Memory");
93   }
94 +
95 + #ifndef NDEBUG
96 + /*
97 + * frob some memory. debugging time.
98 + * -- adrian
99 + */
100 + void
101 + mem_frob(void *data, int len)
102 + {
103 +  /* correct for Intel only! little endian */
104 +  unsigned char b[4] = { 0xef, 0xbe, 0xad, 0xde };
105 +  int i;
106 +  char *cdata = data;
107 +
108 +  for (i = 0; i < len; i++)
109 +  {
110 +    *cdata = b[i % 4];
111 +    cdata++;
112 +  }
113 + }
114 + #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)