[4/6] wpp: get_string() now can return NULL, handle it

Matteo Bruni matteo.mystral at gmail.com
Thu Sep 10 10:41:07 CDT 2009


-------------- next part --------------
From a57696e5ac8e6c81e0ae04595fc6f5355cf56d1c Mon Sep 17 00:00:00 2001
From: Matteo Bruni <matteo.mystral at gmail.com>
Date: Sat, 5 Sep 2009 20:05:15 +0200
Subject: wpp: get_string() now can return NULL, handle it

---
 libs/wpp/ppl.l |    3 +++
 libs/wpp/ppy.y |   12 ++++++------
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/libs/wpp/ppl.l b/libs/wpp/ppl.l
index f0a39a8..d303118 100644
--- a/libs/wpp/ppl.l
+++ b/libs/wpp/ppl.l
@@ -1576,6 +1576,9 @@ void pp_do_include(char *fname, int type)
 	includelogicentry_t *iep;
 	void *fp;
 
+	if(!fname)
+		return;
+
 	for(iep = pp_includelogiclist; iep; iep = iep->next)
 	{
 		if(!strcmp(iep->filename, fname))
diff --git a/libs/wpp/ppy.y b/libs/wpp/ppy.y
index c5aed4d..48e9e23 100644
--- a/libs/wpp/ppy.y
+++ b/libs/wpp/ppy.y
@@ -279,16 +279,16 @@ preprocessor
 	| tMACRO res_arg allmargs tMACROEND opt_mtexts tNL	{
 		pp_add_macro($1, macro_args, nmacro_args, $5);
 		}
-	| tLINE tSINT tDQSTRING	tNL	{ writestring("# %d %s\n", $2 , $3); free($3); }
-	| tGCCLINE tSINT tDQSTRING tNL	{ writestring("# %d %s\n", $2 , $3); free($3); }
+	| tLINE tSINT tDQSTRING	tNL	{ if($3) writestring("# %d %s\n", $2 , $3); free($3); }
+	| tGCCLINE tSINT tDQSTRING tNL	{ if($3) writestring("# %d %s\n", $2 , $3); free($3); }
 	| tGCCLINE tSINT tDQSTRING tSINT tNL
-		{ writestring("# %d %s %d\n", $2, $3, $4); free($3); }
+		{ if($3) writestring("# %d %s %d\n", $2, $3, $4); free($3); }
 	| tGCCLINE tSINT tDQSTRING tSINT tSINT tNL
-		{ writestring("# %d %s %d %d\n", $2 ,$3, $4, $5); free($3); }
+		{ if($3) writestring("# %d %s %d %d\n", $2 ,$3, $4, $5); free($3); }
 	| tGCCLINE tSINT tDQSTRING tSINT tSINT tSINT  tNL
-		{ writestring("# %d %s %d %d %d\n", $2 ,$3 ,$4 ,$5, $6); free($3); }
+		{ if($3) writestring("# %d %s %d %d %d\n", $2 ,$3 ,$4 ,$5, $6); free($3); }
 	| tGCCLINE tSINT tDQSTRING tSINT tSINT tSINT tSINT tNL
-		{ writestring("# %d %s %d %d %d %d\n", $2 ,$3 ,$4 ,$5, $6, $7); free($3); }
+		{ if($3) writestring("# %d %s %d %d %d %d\n", $2 ,$3 ,$4 ,$5, $6, $7); free($3); }
 	| tGCCLINE tNL		/* The null-token */
 	| tERROR opt_text tNL	{ ppy_error("#error directive: '%s'", $2); free($2); }
 	| tWARNING opt_text tNL	{ ppy_warning("#warning directive: '%s'", $2); free($2); }
-- 
1.6.3.3


More information about the wine-patches mailing list