projects
/
libfirm
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
BugFix for a rare case:
[libfirm]
/
ir
/
libcore
/
lc_printf.c
diff --git
a/ir/libcore/lc_printf.c
b/ir/libcore/lc_printf.c
index
89e5120
..
458d3dc
100644
(file)
--- a/
ir/libcore/lc_printf.c
+++ b/
ir/libcore/lc_printf.c
@@
-23,6
+23,7
@@
* @author Sebastian Hack
* @date 4.12.2005
*/
* @author Sebastian Hack
* @date 4.12.2005
*/
+#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdio.h>
@@
-58,7
+59,7
@@
struct _lc_arg_env_t {
/** The default argument environment. */
static lc_arg_env_t *default_env = NULL;
/** The default argument environment. */
static lc_arg_env_t *default_env = NULL;
-static
INLINE
lc_arg_env_t *_lc_arg_get_default_env(void)
+static
inline
lc_arg_env_t *_lc_arg_get_default_env(void)
{
if(!default_env)
default_env = lc_arg_add_std(lc_arg_new_env());
{
if(!default_env)
default_env = lc_arg_add_std(lc_arg_new_env());
@@
-81,8
+82,7
@@
static int lc_arg_cmp(const void *p1, const void *p2, UNUSED(size_t size))
lc_arg_env_t *lc_arg_new_env(void)
{
lc_arg_env_t *lc_arg_new_env(void)
{
- lc_arg_env_t *env = xmalloc(sizeof(*env));
- memset(env, 0, sizeof(*env));
+ lc_arg_env_t *env = XMALLOCZ(lc_arg_env_t);
env->args = new_set(lc_arg_cmp, 16);
return env;
}
env->args = new_set(lc_arg_cmp, 16);
return env;
}
@@
-257,7
+257,7
@@
static int std_emit(lc_appendable_t *app, const lc_arg_occ_t *occ, const lc_arg_
default:
{
int len = LC_MAX(128, occ->width + 1);
default:
{
int len = LC_MAX(128, occ->width + 1);
- char *buf =
xmalloc(len * sizeof(char)
);
+ char *buf =
XMALLOCN(char, len
);
res = dispatch_snprintf(buf, len, fmt, occ->lc_arg_type, val);
res = lc_appendable_snadd(app, buf, res);
xfree(buf);
res = dispatch_snprintf(buf, len, fmt, occ->lc_arg_type, val);
res = lc_appendable_snadd(app, buf, res);
xfree(buf);