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

Comparing ircd-hybrid-7.2/src/memory.c (file contents):
Revision 1010 by lusky, Sun Oct 2 21:05:51 2005 UTC vs.
Revision 1011 by michael, Fri Sep 18 10:14:09 2009 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"
31 #include "list.h"
32 #include "client.h"
33 #include "send.h"
34 #include "tools.h"
30   #include "s_log.h"
31   #include "restart.h"
32  
# 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  
94  was_here = 1;
95
91    ilog(L_CRIT, "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
> Changed lines