Remove some more MEMBUG garbage.
This commit is contained in:
parent
036822584b
commit
62b5690415
|
@ -230,8 +230,6 @@ extern pointer XNFalloc(unsigned long /*amount*/);
|
||||||
extern pointer XNFcalloc(unsigned long /*amount*/);
|
extern pointer XNFcalloc(unsigned long /*amount*/);
|
||||||
extern pointer XNFrealloc(pointer /*ptr*/, unsigned long /*amount*/);
|
extern pointer XNFrealloc(pointer /*ptr*/, unsigned long /*amount*/);
|
||||||
|
|
||||||
extern void OsInitAllocator(void);
|
|
||||||
|
|
||||||
extern char *Xstrdup(const char *s);
|
extern char *Xstrdup(const char *s);
|
||||||
extern char *XNFstrdup(const char *s);
|
extern char *XNFstrdup(const char *s);
|
||||||
extern char *Xprintf(const char *fmt, ...);
|
extern char *Xprintf(const char *fmt, ...);
|
||||||
|
|
|
@ -204,7 +204,6 @@ OsInit(void)
|
||||||
if (!SmartScheduleInit ())
|
if (!SmartScheduleInit ())
|
||||||
SmartScheduleDisable = TRUE;
|
SmartScheduleDisable = TRUE;
|
||||||
#endif
|
#endif
|
||||||
OsInitAllocator();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
42
os/utils.c
42
os/utils.c
|
@ -224,12 +224,6 @@ _X_EXPORT Bool Must_have_memory = FALSE;
|
||||||
#define HAS_SAVED_IDS_AND_SETEUID
|
#define HAS_SAVED_IDS_AND_SETEUID
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef MEMBUG
|
|
||||||
#define MEM_FAIL_SCALE 100000
|
|
||||||
long Memory_fail = 0;
|
|
||||||
#include <stdlib.h> /* for random() */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static char *dev_tty_from_init = NULL; /* since we need to parse it anyway */
|
static char *dev_tty_from_init = NULL; /* since we need to parse it anyway */
|
||||||
|
|
||||||
OsSigHandlerPtr
|
OsSigHandlerPtr
|
||||||
|
@ -496,9 +490,6 @@ void UseMsg(void)
|
||||||
ErrorF("use: X [:<display>] [option]\n");
|
ErrorF("use: X [:<display>] [option]\n");
|
||||||
ErrorF("-a # mouse acceleration (pixels)\n");
|
ErrorF("-a # mouse acceleration (pixels)\n");
|
||||||
ErrorF("-ac disable access control restrictions\n");
|
ErrorF("-ac disable access control restrictions\n");
|
||||||
#ifdef MEMBUG
|
|
||||||
ErrorF("-alloc int chance alloc should fail\n");
|
|
||||||
#endif
|
|
||||||
ErrorF("-audit int set audit trail level\n");
|
ErrorF("-audit int set audit trail level\n");
|
||||||
ErrorF("-auth file select authorization file\n");
|
ErrorF("-auth file select authorization file\n");
|
||||||
ErrorF("-br create root window with black background\n");
|
ErrorF("-br create root window with black background\n");
|
||||||
|
@ -644,15 +635,6 @@ ProcessCommandLine(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
defeatAccessControl = TRUE;
|
defeatAccessControl = TRUE;
|
||||||
}
|
}
|
||||||
#ifdef MEMBUG
|
|
||||||
else if ( strcmp( argv[i], "-alloc") == 0)
|
|
||||||
{
|
|
||||||
if(++i < argc)
|
|
||||||
Memory_fail = atoi(argv[i]);
|
|
||||||
else
|
|
||||||
UseMsg();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
else if ( strcmp( argv[i], "-audit") == 0)
|
else if ( strcmp( argv[i], "-audit") == 0)
|
||||||
{
|
{
|
||||||
if(++i < argc)
|
if(++i < argc)
|
||||||
|
@ -1108,11 +1090,6 @@ Xalloc(unsigned long amount)
|
||||||
}
|
}
|
||||||
/* aligned extra on long word boundary */
|
/* aligned extra on long word boundary */
|
||||||
amount = (amount + (sizeof(long) - 1)) & ~(sizeof(long) - 1);
|
amount = (amount + (sizeof(long) - 1)) & ~(sizeof(long) - 1);
|
||||||
#ifdef MEMBUG
|
|
||||||
if (!Must_have_memory && Memory_fail &&
|
|
||||||
((random() % MEM_FAIL_SCALE) < Memory_fail))
|
|
||||||
return (unsigned long *)NULL;
|
|
||||||
#endif
|
|
||||||
if ((ptr = (pointer)malloc(amount))) {
|
if ((ptr = (pointer)malloc(amount))) {
|
||||||
return (unsigned long *)ptr;
|
return (unsigned long *)ptr;
|
||||||
}
|
}
|
||||||
|
@ -1184,11 +1161,6 @@ XNFcalloc(unsigned long amount)
|
||||||
_X_EXPORT void *
|
_X_EXPORT void *
|
||||||
Xrealloc(pointer ptr, unsigned long amount)
|
Xrealloc(pointer ptr, unsigned long amount)
|
||||||
{
|
{
|
||||||
#ifdef MEMBUG
|
|
||||||
if (!Must_have_memory && Memory_fail &&
|
|
||||||
((random() % MEM_FAIL_SCALE) < Memory_fail))
|
|
||||||
return (unsigned long *)NULL;
|
|
||||||
#endif
|
|
||||||
if ((long)amount <= 0)
|
if ((long)amount <= 0)
|
||||||
{
|
{
|
||||||
if (ptr && !amount)
|
if (ptr && !amount)
|
||||||
|
@ -1234,20 +1206,6 @@ Xfree(pointer ptr)
|
||||||
if (ptr)
|
if (ptr)
|
||||||
free((char *)ptr);
|
free((char *)ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
OsInitAllocator (void)
|
|
||||||
{
|
|
||||||
#ifdef MEMBUG
|
|
||||||
static int been_here;
|
|
||||||
|
|
||||||
/* Check the memory system after each generation */
|
|
||||||
if (been_here)
|
|
||||||
CheckMemory ();
|
|
||||||
else
|
|
||||||
been_here = 1;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#endif /* !INTERNAL_MALLOC */
|
#endif /* !INTERNAL_MALLOC */
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue