aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src
diff options
context:
space:
mode:
authorPaul Eggert2011-02-25 16:22:13 -0800
committerPaul Eggert2011-02-25 16:22:13 -0800
commit34e6d7823aeee6c20219bbab1045ca6649ca8fa5 (patch)
treed71cbb6c8c98583a3d878b77191714777c4b0aa0 /lib-src
parent4be3dfc5e303160859a7666d725512691aedd837 (diff)
downloademacs-34e6d7823aeee6c20219bbab1045ca6649ca8fa5.tar.gz
emacs-34e6d7823aeee6c20219bbab1045ca6649ca8fa5.zip
* ebrowse.c (putstr): Rename from PUTSTR and turn into a function.
All callers changed. This is cleaner, and avoids GCC warnings about passing NULL to fputs.
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/ChangeLog6
-rw-r--r--lib-src/ebrowse.c59
2 files changed, 36 insertions, 29 deletions
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog
index 699eaf4cba9..969a84ca6bf 100644
--- a/lib-src/ChangeLog
+++ b/lib-src/ChangeLog
@@ -1,3 +1,9 @@
12011-02-26 Paul Eggert <eggert@cs.ucla.edu>
2
3 * ebrowse.c (putstr): Rename from PUTSTR and turn into a function.
4 All callers changed. This is cleaner, and avoids GCC warnings about
5 passing NULL to fputs.
6
12011-02-25 Paul Eggert <eggert@cs.ucla.edu> 72011-02-25 Paul Eggert <eggert@cs.ucla.edu>
2 8
3 * emacsclient.c (main): Avoid dangling 'if'. 9 * emacsclient.c (main): Avoid dangling 'if'.
diff --git a/lib-src/ebrowse.c b/lib-src/ebrowse.c
index f2894d5a0c2..bc537ec719c 100644
--- a/lib-src/ebrowse.c
+++ b/lib-src/ebrowse.c
@@ -1108,22 +1108,23 @@ leave_namespace (void)
1108/* Write string S to the output file FP in a Lisp-readable form. 1108/* Write string S to the output file FP in a Lisp-readable form.
1109 If S is null, write out `()'. */ 1109 If S is null, write out `()'. */
1110 1110
1111#define PUTSTR(s, fp) \ 1111static inline void
1112 do { \ 1112putstr (const char *s, FILE *fp)
1113 if (!s) \ 1113{
1114 { \ 1114 if (!s)
1115 putc ('(', fp); \ 1115 {
1116 putc (')', fp); \ 1116 putc ('(', fp);
1117 putc (' ', fp); \ 1117 putc (')', fp);
1118 } \ 1118 putc (' ', fp);
1119 else \ 1119 }
1120 { \ 1120 else
1121 putc ('"', fp); \ 1121 {
1122 fputs (s, fp); \ 1122 putc ('"', fp);
1123 putc ('"', fp); \ 1123 fputs (s, fp);
1124 putc (' ', fp); \ 1124 putc ('"', fp);
1125 } \ 1125 putc (' ', fp);
1126 } while (0) 1126 }
1127}
1127 1128
1128/* A dynamically allocated buffer for constructing a scope name. */ 1129/* A dynamically allocated buffer for constructing a scope name. */
1129 1130
@@ -1216,16 +1217,16 @@ dump_members (FILE *fp, struct member *m)
1216 for (n = 0; m; m = m->next, ++n) 1217 for (n = 0; m; m = m->next, ++n)
1217 { 1218 {
1218 fputs (MEMBER_STRUCT, fp); 1219 fputs (MEMBER_STRUCT, fp);
1219 PUTSTR (m->name, fp); 1220 putstr (m->name, fp);
1220 PUTSTR (NULL, fp); /* FIXME? scope for globals */ 1221 putstr (NULL, fp); /* FIXME? scope for globals */
1221 fprintf (fp, "%u ", (unsigned) m->flags); 1222 fprintf (fp, "%u ", (unsigned) m->flags);
1222 PUTSTR (m->filename, fp); 1223 putstr (m->filename, fp);
1223 PUTSTR (m->regexp, fp); 1224 putstr (m->regexp, fp);
1224 fprintf (fp, "%u ", (unsigned) m->pos); 1225 fprintf (fp, "%u ", (unsigned) m->pos);
1225 fprintf (fp, "%u ", (unsigned) m->vis); 1226 fprintf (fp, "%u ", (unsigned) m->vis);
1226 putc (' ', fp); 1227 putc (' ', fp);
1227 PUTSTR (m->def_filename, fp); 1228 putstr (m->def_filename, fp);
1228 PUTSTR (m->def_regexp, fp); 1229 putstr (m->def_regexp, fp);
1229 fprintf (fp, "%u", (unsigned) m->def_pos); 1230 fprintf (fp, "%u", (unsigned) m->def_pos);
1230 putc (']', fp); 1231 putc (']', fp);
1231 putc ('\n', fp); 1232 putc ('\n', fp);
@@ -1243,20 +1244,20 @@ static void
1243dump_sym (FILE *fp, struct sym *root) 1244dump_sym (FILE *fp, struct sym *root)
1244{ 1245{
1245 fputs (CLASS_STRUCT, fp); 1246 fputs (CLASS_STRUCT, fp);
1246 PUTSTR (root->name, fp); 1247 putstr (root->name, fp);
1247 1248
1248 /* Print scope, if any. */ 1249 /* Print scope, if any. */
1249 if (root->namesp) 1250 if (root->namesp)
1250 PUTSTR (sym_scope (root), fp); 1251 putstr (sym_scope (root), fp);
1251 else 1252 else
1252 PUTSTR (NULL, fp); 1253 putstr (NULL, fp);
1253 1254
1254 /* Print flags. */ 1255 /* Print flags. */
1255 fprintf (fp, "%u", root->flags); 1256 fprintf (fp, "%u", root->flags);
1256 PUTSTR (root->filename, fp); 1257 putstr (root->filename, fp);
1257 PUTSTR (root->regexp, fp); 1258 putstr (root->regexp, fp);
1258 fprintf (fp, "%u", (unsigned) root->pos); 1259 fprintf (fp, "%u", (unsigned) root->pos);
1259 PUTSTR (root->sfilename, fp); 1260 putstr (root->sfilename, fp);
1260 putc (']', fp); 1261 putc (']', fp);
1261 putc ('\n', fp); 1262 putc ('\n', fp);
1262} 1263}
@@ -1323,7 +1324,7 @@ dump_roots (FILE *fp)
1323 if (!f_append) 1324 if (!f_append)
1324 { 1325 {
1325 fputs (TREE_HEADER_STRUCT, fp); 1326 fputs (TREE_HEADER_STRUCT, fp);
1326 PUTSTR (EBROWSE_FILE_VERSION, fp); 1327 putstr (EBROWSE_FILE_VERSION, fp);
1327 1328
1328 putc ('\"', fp); 1329 putc ('\"', fp);
1329 if (!f_structs) 1330 if (!f_structs)