bison-patches
[Top][All Lists]
Advanced

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

RFC: [PATCH] maint: use xconcatenated_filename


From: Akim Demaille
Subject: RFC: [PATCH] maint: use xconcatenated_filename
Date: Fri, 25 May 2012 09:42:48 +0200

Hi Paul,

the attached patch is for master.  It simplifies some code
you wrote using features from gnulib.  There is a
difference I'd like to understand better though:
you use mbschr to look for `/' in file names, whereas Bruno
uses strchr.

You wrote:

-  if (mbschr (skeleton, '/'))
-    strcpy (full_skeleton, skeleton);
-  else
-    strcpy (full_skeleton + pkgdatadirlen + 1, skeleton);

I propose:

+  char *skel =
+    IS_PATH_WITH_DIR (skeleton) ? xstrdup (skeleton)
+    :  xconcatenated_filename (datadir, skeleton, NULL);

where (from gnulib's filename.h)

# define IS_PATH_WITH_DIR(P) (strchr (P, '/') != NULL)

I see no reason for a difference between Bison and gnulib
on this regard, so "which one is right"?  Should I send a
patch to gnulib to switch to mbschr?

The patch is also (on top of master) in the branch mbschr.

Attachment: 0001-maint-use-xconcatenated_filename.patch
Description: Binary data


reply via email to

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