bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] yysyntax_error: make it manage its own memory.


From: Akim Demaille
Subject: Re: [PATCH] yysyntax_error: make it manage its own memory.
Date: Thu, 10 Sep 2009 14:13:05 +0200


Le 10 sept. 2009 à 07:16, Joel E. Denny a écrit :

I'd like to push this patch to master and branch-2.5. I need it for that lookahead correction implementation I spoke about recently, but I think it's worthwhile on its own as well. Any objections? I haven't looked at porting this to the other skeletons yet, but would there be any objections
there?

From d3334adb83a8b87cfa7528ab184d0dbbe7283858 Mon Sep 17 00:00:00 2001
From: Joel E. Denny <address@hidden>
Date: Mon, 7 Sep 2009 22:01:16 -0400
Subject: [PATCH] yysyntax_error: make it manage its own memory.

This improves readability, eliminates the need to invoke the
function twice and thus repeat the lookahead collection, and
prepares for future extensions that will make those repetitions
more expensive and that will require additional memory
management in yysyntax_error.
* data/yacc.c (yysyntax_error): Add arguments for message
buffer variables stored in the parser.  Instead of size, return
status similar to yyparse status but indicating success of
message creation.  Import memory management code from...
(yyparse, yypush_parse): ... here.

Hi Joel,

I'm not sure I understand what's going on here. The code is meant to be used with either alloca or malloc, and now that you moved everything in syntax_error, I fail to see how alloca could work as expected. Reading the patch (not the resulting code), it really seems like you're possibly returning some pointer to a alloca'ed block of memory.

I can't see how alloca could be used if not the way Paul made it.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]