aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2016-05-16 20:16:27 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2016-05-16 20:16:27 +0000
commitd229eb6b67b5c6c94453a7892280742809f5ad46 (patch)
tree603876dd37d329c801bf4d1aabc96c733a18b05f
parent230db2d8db54f9bd7f28169f4ce6b763304f2647 (diff)
downloadgdbm-d229eb6b67b5c6c94453a7892280742809f5ad46.tar.gz
gdbm-d229eb6b67b5c6c94453a7892280742809f5ad46.tar.bz2
Minor improvements
* src/gdbmtool.c (_gdbm_print_bucket_cache): Use %zu to print size_t. * src/gdbmtool.h (variable_unset): New proto. (yyerror): Argument is char const *. src/gram.y: Likewise. * src/lex.l: Add option noinput * src/parseopt.c (print_option_descr): Use fwrite instead of printf. * src/var.c: Fix initializers to suppress warnings.
-rw-r--r--ChangeLog12
-rw-r--r--src/gdbmtool.c2
-rw-r--r--src/gdbmtool.h7
-rw-r--r--src/gram.y2
-rw-r--r--src/lex.l1
-rw-r--r--src/parseopt.c3
-rw-r--r--src/var.c16
7 files changed, 29 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index 0b4c5f4..4d62562 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2016-05-16 Sergey Poznyakoff <gray@gnu.org.ua>
+
+ * src/gdbmtool.c (_gdbm_print_bucket_cache): Use %zu to print
+ size_t.
+ * src/gdbmtool.h (variable_unset): New proto.
+ (yyerror): Argument is char const *.
+ * src/gram.y: Likewise.
+ * src/lex.l: Add option noinput
+ * src/parseopt.c (print_option_descr): Use fwrite instead of
+ printf.
+ * src/var.c: Fix initializers to suppress warnings.
+
2015-12-05 Sergey Poznyakoff <gray@gnu.org.ua>
* doc/gendocs_template: Add references to manpages.
diff --git a/src/gdbmtool.c b/src/gdbmtool.c
index 258c873..c3e0faa 100644
--- a/src/gdbmtool.c
+++ b/src/gdbmtool.c
@@ -270,7 +270,7 @@ _gdbm_print_bucket_cache (FILE *fp, GDBM_FILE dbf)
if (dbf->bucket_cache != NULL)
{
fprintf (fp,
- _("Bucket Cache (size %d):\n Index: Address Changed Data_Hash \n"),
+ _("Bucket Cache (size %zu):\n Index: Address Changed Data_Hash \n"),
dbf->cache_size);
for (index = 0; index < dbf->cache_size; index++)
{
diff --git a/src/gdbmtool.h b/src/gdbmtool.h
index 224e68f..84f1409 100644
--- a/src/gdbmtool.h
+++ b/src/gdbmtool.h
@@ -1,6 +1,6 @@
/* This file is part of GDBM, the GNU data base manager.
- Copyright (C) 1990, 1991, 1993, 2007, 2011, 2013 Free Software Foundation,
- Inc.
+ Copyright (C) 1990, 1991, 1993, 2007, 2011, 2013,
+ 2016 Free Software Foundation, Inc.
GDBM is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -239,6 +239,7 @@ extern struct dsegm *dsdef[];
int variable_set (const char *name, int type, void *val);
int variable_get (const char *name, int type, void **val);
+int variable_unset(const char *name);
int variable_is_set (const char *name);
int variable_is_true (const char *name);
void variable_print_all (FILE *fp);
@@ -250,7 +251,7 @@ void begin_def (void);
void end_def (void);
int yylex (void);
-int yyerror (char *s);
+int yyerror (char const *s);
int yyparse (void);
void datum_format (FILE *fp, datum const *dat, struct dsegm *ds);
diff --git a/src/gram.y b/src/gram.y
index f654edb..908628a 100644
--- a/src/gram.y
+++ b/src/gram.y
@@ -361,7 +361,7 @@ terror (const char *fmt, ...)
}
int
-yyerror (char *s)
+yyerror (char const *s)
{
terror ("%s", s);
return 0;
diff --git a/src/lex.l b/src/lex.l
index 4fabb07..5c409aa 100644
--- a/src/lex.l
+++ b/src/lex.l
@@ -194,6 +194,7 @@ setsource (const char *name, int intr)
}
%}
+%option noinput
%option nounput
%x STR MLSTR DEF
diff --git a/src/parseopt.c b/src/parseopt.c
index cd175c5..e39973b 100644
--- a/src/parseopt.c
+++ b/src/parseopt.c
@@ -240,7 +240,8 @@ print_option_descr (const char *descr, size_t lmargin, size_t rmargin)
break;
}
}
- printf ("%*.*s\n", s, s, descr);
+ fwrite (descr, 1, s, stdout);
+ fputc ('\n', stdout);
descr += s;
if (*descr)
{
diff --git a/src/var.c b/src/var.c
index 1194d81..65ea2a1 100644
--- a/src/var.c
+++ b/src/var.c
@@ -45,20 +45,20 @@ static int open_hook (struct variable *, union value *);
static struct variable vartab[] = {
/* Top-level prompt */
- { "ps1", VART_STRING, VARF_INIT, { "%p>%_" } },
+ { "ps1", VART_STRING, VARF_INIT, { .string = "%p>%_" } },
/* Second-level prompt (used within "def" block) */
- { "ps2", VART_STRING, VARF_INIT, { "%_>%_" } },
+ { "ps2", VART_STRING, VARF_INIT, { .string = "%_>%_" } },
/* This delimits array members */
- { "delim1", VART_STRING, VARF_INIT|VARF_PROT, { "," } },
+ { "delim1", VART_STRING, VARF_INIT|VARF_PROT, { .string = "," } },
/* This delimits structure members */
- { "delim2", VART_STRING, VARF_INIT|VARF_PROT, { "," } },
- { "confirm", VART_BOOL, VARF_INIT, { .num = 1 } },
+ { "delim2", VART_STRING, VARF_INIT|VARF_PROT, { .string = "," } },
+ { "confirm", VART_BOOL, VARF_INIT, { .bool = 1 } },
{ "cachesize", VART_INT, VARF_DFL },
{ "blocksize", VART_INT, VARF_DFL },
{ "open", VART_STRING, VARF_DFL, { NULL }, open_hook },
- { "lock", VART_BOOL, VARF_INIT, { .num = 1 } },
- { "mmap", VART_BOOL, VARF_INIT, { .num = 1 } },
- { "sync", VART_BOOL, VARF_INIT, { .num = 0 } },
+ { "lock", VART_BOOL, VARF_INIT, { .bool = 1 } },
+ { "mmap", VART_BOOL, VARF_INIT, { .bool = 1 } },
+ { "sync", VART_BOOL, VARF_INIT, { .bool = 0 } },
{ "filemode", VART_INT, VARF_INIT|VARF_OCTAL|VARF_PROT, { .num = 0644 } },
{ "pager", VART_STRING, VARF_DFL },
{ "quiet", VART_BOOL, VARF_DFL },

Return to:

Send suggestions and report system problems to the System administrator.