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 |
|
|
41 |
|
|
42 |
|
if (ret == NULL) |
43 |
|
outofmemory(); |
44 |
< |
return(ret); |
44 |
> |
|
45 |
> |
return ret; |
46 |
|
} |
47 |
|
|
48 |
|
/* |
55 |
|
|
56 |
|
if (ret == NULL) |
57 |
|
outofmemory(); |
58 |
< |
return(ret); |
58 |
> |
|
59 |
> |
return ret; |
60 |
|
} |
61 |
|
|
62 |
|
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 |