projects
/
tinc
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
210a92c
)
Pass the requested size from xmalloc() and xrealloc() on to xalloc_fail_func()
author
Ivo Timmermans
<ivo@lychnis.net>
Mon, 17 Apr 2000 16:23:29 +0000
(16:23 +0000)
committer
Ivo Timmermans
<ivo@lychnis.net>
Mon, 17 Apr 2000 16:23:29 +0000
(16:23 +0000)
lib/xmalloc.c
patch
|
blob
|
history
src/tincd.c
patch
|
blob
|
history
diff --git
a/lib/xmalloc.c
b/lib/xmalloc.c
index
204469f
..
6cb0b82
100644
(file)
--- a/
lib/xmalloc.c
+++ b/
lib/xmalloc.c
@@
-69,7
+69,7
@@
int xalloc_exit_failure = EXIT_FAILURE;
char *const xalloc_msg_memory_exhausted = N_("Memory exhausted");
/* FIXME: describe */
char *const xalloc_msg_memory_exhausted = N_("Memory exhausted");
/* FIXME: describe */
-void (*xalloc_fail_func) () = 0;
+void (*xalloc_fail_func) (
int
) = 0;
#if __STDC__ && (HAVE_VPRINTF || HAVE_DOPRNT)
void error (int, int, const char *, ...);
#if __STDC__ && (HAVE_VPRINTF || HAVE_DOPRNT)
void error (int, int, const char *, ...);
@@
-78,10
+78,10
@@
void error ();
#endif
static void
#endif
static void
-xalloc_fail ()
+xalloc_fail (
int size
)
{
if (xalloc_fail_func)
{
if (xalloc_fail_func)
- (*xalloc_fail_func) ();
+ (*xalloc_fail_func) (
size
);
error (xalloc_exit_failure, 0, xalloc_msg_memory_exhausted);
}
error (xalloc_exit_failure, 0, xalloc_msg_memory_exhausted);
}
@@
-92,10
+92,12
@@
xmalloc (n)
size_t n;
{
void *p;
size_t n;
{
void *p;
+ extern char*cp_file;
+ extern int cp_line;
p = malloc (n);
if (p == 0)
p = malloc (n);
if (p == 0)
- xalloc_fail ();
+ xalloc_fail (
(int)n
);
return p;
}
return p;
}
@@
-110,7
+112,7
@@
xrealloc (p, n)
{
p = realloc (p, n);
if (p == 0)
{
p = realloc (p, n);
if (p == 0)
- xalloc_fail ();
+ xalloc_fail (
n
);
return p;
}
return p;
}
diff --git
a/src/tincd.c
b/src/tincd.c
index
433b5e6
..
a8ea62c
100644
(file)
--- a/
src/tincd.c
+++ b/
src/tincd.c
@@
-19,6
+19,9
@@
/*
* $Log: tincd.c,v $
/*
* $Log: tincd.c,v $
+ * Revision 1.5 2000/04/17 16:23:29 zarq
+ * Pass the requested size from xmalloc() and xrealloc() on to xalloc_fail_func()
+ *
* Revision 1.4 2000/04/06 18:28:29 zarq
* New option -D, don't detach.
*
* Revision 1.4 2000/04/06 18:28:29 zarq
* New option -D, don't detach.
*
@@
-156,9
+159,9
@@
parse_options(int argc, char **argv, char **envp)
}
}
}
}
-void memory_full(
void
)
+void memory_full(
int size
)
{
{
- syslog(LOG_ERR, "Memory exhausted
; exiting."
);
+ syslog(LOG_ERR, "Memory exhausted
(last is %s:%d) (couldn't allocate %d bytes); exiting.", cp_file, cp_line, size
);
exit(1);
}
exit(1);
}