diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2016-05-16 20:16:27 +0000 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2016-05-16 20:16:27 +0000 |
commit | d229eb6b67b5c6c94453a7892280742809f5ad46 (patch) | |
tree | 603876dd37d329c801bf4d1aabc96c733a18b05f | |
parent | 230db2d8db54f9bd7f28169f4ce6b763304f2647 (diff) | |
download | gdbm-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-- | ChangeLog | 12 | ||||
-rw-r--r-- | src/gdbmtool.c | 2 | ||||
-rw-r--r-- | src/gdbmtool.h | 7 | ||||
-rw-r--r-- | src/gram.y | 2 | ||||
-rw-r--r-- | src/lex.l | 1 | ||||
-rw-r--r-- | src/parseopt.c | 3 | ||||
-rw-r--r-- | src/var.c | 16 |
7 files changed, 29 insertions, 14 deletions
@@ -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); @@ -361,7 +361,7 @@ terror (const char *fmt, ...) } int -yyerror (char *s) +yyerror (char const *s) { terror ("%s", s); return 0; @@ -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) { @@ -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 }, |