[BusyBox] coreutils/date.c buffer [PATCH]
Shaun Jackman
sjackman at gmail.com
Tue Mar 8 21:19:20 UTC 2005
2005-03-08 Shaun Jackman <sjackman at gmail.com>
* coreutils/date.c (date_main): Use RESERVE_CONFIG_BUFFER instead
of xmalloc and free the buffer if CONFIG_FEATURE_CLEAN_UP is set.
--- coreutils/date.c- 2004-10-11 13:52:16.000000000 -0700
+++ coreutils/date.c 2005-03-08 12:51:26.000000000 -0800
@@ -136,7 +136,6 @@
{
char *date_str = NULL;
char *date_fmt = NULL;
- char *t_buff;
int set_time;
int utc;
int use_arg = 0;
@@ -283,10 +282,15 @@
date_fmt = "%Y.%m.%d-%H:%M:%S";
}
- /* Print OUTPUT (after ALL that!) */
- t_buff = xmalloc(201);
- strftime(t_buff, 200, date_fmt, &tm_time);
- puts(t_buff);
+ {
+ /* Print OUTPUT (after ALL that!) */
+ RESERVE_CONFIG_BUFFER(t_buff, 201);
+ strftime(t_buff, 200, date_fmt, &tm_time);
+ puts(t_buff);
+#ifdef CONFIG_FEATURE_CLEAN_UP
+ RELEASE_CONFIG_BUFFER(t_buff);
+#endif
+ }
return EXIT_SUCCESS;
}
More information about the busybox
mailing list