aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2011-08-03 12:40:27 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2011-08-03 12:40:27 +0000
commit0b2a60058ecc691c1781358264691a8e5410aaa5 (patch)
tree785499c312d804be7c0d2ca614590c0c45197d35
parentd04fa3e655613536ef7610c896ddd4b7a8a37d2f (diff)
downloadgdbm-0b2a60058ecc691c1781358264691a8e5410aaa5.tar.gz
gdbm-0b2a60058ecc691c1781358264691a8e5410aaa5.tar.bz2
Minor changes.
-rw-r--r--src/flatfile.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/flatfile.c b/src/flatfile.c
index 4589864..5b96d5f 100644
--- a/src/flatfile.c
+++ b/src/flatfile.c
@@ -27,12 +27,10 @@
extern const char * gdbm_version;
+#endif
+
int
gdbm_export (GDBM_FILE dbf, const char *exportfile, int flags, int mode)
-#else
-int
-gdbm_export (GDBM_FILE dbf, const char *exportfile, int flags, int mode)
-#endif
{
int nfd, size;
datum key, nextkey, data;
@@ -41,7 +39,8 @@ gdbm_export (GDBM_FILE dbf, const char *exportfile, int flags, int mode)
int count = 0;
/* Only support GDBM_WCREAT or GDBM_NEWDB */
- switch (flags) {
+ switch (flags)
+ {
case GDBM_WRCREAT:
nfd = open (exportfile, O_WRONLY | O_CREAT | O_EXCL, mode);
if (nfd == -1)
@@ -66,7 +65,7 @@ gdbm_export (GDBM_FILE dbf, const char *exportfile, int flags, int mode)
#endif
return -1;
}
-
+
/* Write out the text header. */
if (write (nfd, header1, strlen (header1)) != strlen (header1))
goto write_fail;
@@ -100,15 +99,15 @@ gdbm_export (GDBM_FILE dbf, const char *exportfile, int flags, int mode)
free (key.dptr);
free (data.dptr);
key = nextkey;
-
+
count++;
}
close (nfd);
-
+
return count;
-
-write_fail:
-
+
+ write_fail:
+
gdbm_errno = GDBM_FILE_WRITE_ERROR;
return -1;
}

Return to:

Send suggestions and report system problems to the System administrator.