From a807fb72c45888b5ff915aa08d8bd10069be4a2e Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Tue, 18 May 2010 22:10:04 -0700 Subject: Rewrite macro handling to support function-like macro invocation in macro values The rewrite her discards the functions that did direct, recursive expansion of macro values. Instead, the parser now pushes the macro definition string over to a stack of buffers for the lexer. This way, macro expansion gets access to all parsing machinery. This isn't a small change, but the result is simpler than before (I think). It passes the entire test suite, including the four tests added with the previous commit that were failing before. --- xtalloc.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'xtalloc.c') diff --git a/xtalloc.c b/xtalloc.c index 849e12d349..d9893ae889 100644 --- a/xtalloc.c +++ b/xtalloc.c @@ -50,3 +50,17 @@ xtalloc_strdup (const void *t, const char *p) return ret; } + +char * +xtalloc_strndup (const void *t, const char *p, size_t n) +{ + char *ret; + + ret = talloc_strndup (t, p, n); + if (ret == NULL) { + fprintf (stderr, "Out of memory.\n"); + exit (1); + } + + return ret; +} -- cgit v1.2.3