Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Clean up more warnings in zdbc * zdbc.c (parse_opt): Correct a long-standing bug in setting the mmap_size and num_buckets. Clean up warnings. Set a more sensible default memmap size (128KiB).
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:c96b0c4ae3da99a7844ffffb4c16dbfa26389a94
User & Date: brandon 2016-05-27 19:58:33
Context
2016-06-12
14:07
remove unnecessary headers check-in: 56b3b1a867 user: brandon tags: trunk
2016-05-27
19:58
Clean up more warnings in zdbc * zdbc.c (parse_opt): Correct a long-standing bug in setting the mmap_size and num_buckets. Clean up warnings. Set a more sensible default memmap size (128KiB). check-in: c96b0c4ae3 user: brandon tags: trunk
19:38
use a more sensible default memmap size (128kb) check-in: 1a645986ae user: brandon tags: trunk
Changes

Changes to src/zdbc.c.

18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
...
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
...
165
166
167
168
169
170
171
172
173
174
175
176
177
   along with zeptodb.  If not, see <http://www.gnu.org/licenses/>.
*/

#include "zdbc.h"

const char *argp_program_version = PACKAGE_STRING;
const char *argp_program_bug_address = PACKAGE_BUGREPORT;
void *database;

static char doc[] =
  "zdbc -- a tool for creating a DBM database";

static char args_doc[] = "DATABASE";

static struct argp_option options[] = {
................................................................................
      break;
    default:
      return ARGP_ERR_UNKNOWN;
    }
  return 0;
}

static struct argp argp = { options, parse_opt, args_doc, doc };

void
termination_handler (int signum)
{
  printf ("Interrupt caught, closing database\n");
  if (zdb_close (database, false))
    error (EXIT_FAILURE, errno, "Failed to close database");
  else
    exit (EXIT_SUCCESS);
}

int
main (int argc, char **argv)
................................................................................

  /* open the database */
  database = zdb_create (arguments.args[0], arguments.mmap_size,
                         arguments.num_buckets,  arguments.verbose, mode);
  if (!database)
    error (EXIT_FAILURE, errno,
           "Failed to create database %s", arguments.args[0]);

  if (zdb_close (database, arguments.verbose))
    error (EXIT_FAILURE, errno,
           "Failed to close database %s", arguments.args[0]);
  exit (EXIT_SUCCESS);
}







|







 







|

|
|


|







 







<
|




18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
...
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
...
165
166
167
168
169
170
171

172
173
174
175
176
   along with zeptodb.  If not, see <http://www.gnu.org/licenses/>.
*/

#include "zdbc.h"

const char *argp_program_version = PACKAGE_STRING;
const char *argp_program_bug_address = PACKAGE_BUGREPORT;
static void *database;

static char doc[] =
  "zdbc -- a tool for creating a DBM database";

static char args_doc[] = "DATABASE";

static struct argp_option options[] = {
................................................................................
      break;
    default:
      return ARGP_ERR_UNKNOWN;
    }
  return 0;
}

static struct argp argp = {options, parse_opt, args_doc, doc, NULL, NULL, NULL};

static void
termination_handler (int signum __attribute__ ((unused)))
{
  printf ("Interrupt caught, closing database\n");
  if (database && zdb_close (database, false))
    error (EXIT_FAILURE, errno, "Failed to close database");
  else
    exit (EXIT_SUCCESS);
}

int
main (int argc, char **argv)
................................................................................

  /* open the database */
  database = zdb_create (arguments.args[0], arguments.mmap_size,
                         arguments.num_buckets,  arguments.verbose, mode);
  if (!database)
    error (EXIT_FAILURE, errno,
           "Failed to create database %s", arguments.args[0]);

  else if (zdb_close (database, arguments.verbose))
    error (EXIT_FAILURE, errno,
           "Failed to close database %s", arguments.args[0]);
  exit (EXIT_SUCCESS);
}