aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2011-08-03 12:40:48 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2011-08-03 12:40:48 +0000
commit413163f4f7012f9e648d9dbd7e64afa288c0ed57 (patch)
tree20d0abeff9826ba4efaf34781da585eba3e0585e
parent0b2a60058ecc691c1781358264691a8e5410aaa5 (diff)
downloadgdbm-413163f4f7012f9e648d9dbd7e64afa288c0ed57.tar.gz
gdbm-413163f4f7012f9e648d9dbd7e64afa288c0ed57.tar.bz2
(gdbm_errlist): Indicate the size of
array and document its entries to minimize the possibility of errors when editing it.
-rw-r--r--src/gdbmerrno.c35
1 files changed, 26 insertions, 9 deletions
diff --git a/src/gdbmerrno.c b/src/gdbmerrno.c
index bc617b1..a7a66eb 100644
--- a/src/gdbmerrno.c
+++ b/src/gdbmerrno.c
@@ -1,7 +1,7 @@
/* gdbmerrno.c - convert gdbm errors into english. */
/* This file is part of GDBM, the GNU data base manager.
- Copyright (C) 1993, 2007 Free Software Foundation, Inc.
+ Copyright (C) 1993, 2007, 2011 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -25,14 +25,31 @@
/* this is not static so that applications may access the array if they
like. it must be in the same order as the error codes! */
-const char * const gdbm_errlist[] = {
- "No error", "Malloc error", "Block size error", "File open error",
- "File write error", "File seek error", "File read error",
- "Bad magic number", "Empty database", "Can't be reader", "Can't be writer",
- "Reader can't delete", "Reader can't store", "Reader can't reorganize",
- "Unknown update", "Item not found", "Reorganize failed", "Cannot replace",
- "Illegal data", "Option already set", "Illegal option", "Byte-swapped file",
- "Wrong file offset", "Bad file flags"
+const char * const gdbm_errlist[_GDBM_MAX_ERRNO+1] = {
+ "No error", /* GDBM_NO_ERROR */
+ "Malloc error", /* GDBM_MALLOC_ERROR */
+ "Block size error", /* GDBM_BLOCK_SIZE_ERROR */
+ "File open error", /* GDBM_FILE_OPEN_ERROR */
+ "File write error", /* GDBM_FILE_WRITE_ERROR */
+ "File seek error", /* GDBM_FILE_SEEK_ERROR */
+ "File read error", /* GDBM_FILE_READ_ERROR */
+ "Bad magic number", /* GDBM_BAD_MAGIC_NUMBER */
+ "Empty database", /* GDBM_EMPTY_DATABASE */
+ "Can't be reader", /* GDBM_CANT_BE_READER */
+ "Can't be writer", /* GDBM_CANT_BE_WRITER */
+ "Reader can't delete", /* GDBM_READER_CANT_DELETE */
+ "Reader can't store", /* GDBM_READER_CANT_STORE */
+ "Reader can't reorganize", /* GDBM_READER_CANT_REORGANIZE */
+ "Unknown update", /* GDBM_UNKNOWN_UPDATE */
+ "Item not found", /* GDBM_ITEM_NOT_FOUND */
+ "Reorganize failed", /* GDBM_REORGANIZE_FAILED */
+ "Cannot replace", /* GDBM_CANNOT_REPLACE */
+ "Illegal data", /* GDBM_ILLEGAL_DATA */
+ "Option already set", /* GDBM_OPT_ALREADY_SET */
+ "Illegal option", /* GDBM_OPT_ILLEGAL */
+ "Byte-swapped file", /* GDBM_BYTE_SWAPPED */
+ "Wrong file offset", /* GDBM_BAD_FILE_OFFSET */
+ "Bad file flags" /* GDBM_BAD_OPEN_FLAGS */
};
const char *

Return to:

Send suggestions and report system problems to the System administrator.