Not logged in

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

Overview
Comment:fix bug in setting the number of buckets
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:f617f59f6b52eca4518b8ec99087308946aed196
User & Date: brandon 2016-05-27 19:26:59
Context
2016-05-27
19:36
fix bug in setting the mmap size check-in: e9d74ac51e user: brandon tags: trunk
19:26
fix bug in setting the number of buckets check-in: f617f59f6b user: brandon tags: trunk
19:25
fix more annoying warnings check-in: 3b93189a99 user: brandon tags: trunk
Changes

Changes to src/zdbc.c.

64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
parse_opt (int key, char *arg, struct argp_state *state)
{
  struct arguments *arguments = state->input;
  unsigned long int size;
  switch (key)
    {
    case 'b':
      size = arg ? strtoul (arg, NULL, 10) : 100;
      if (size > sizeof(size_t) || size <= 0)
        {
          arguments->num_buckets = sizeof(size_t);
        }
      else
        {
          arguments->num_buckets = (size_t)size;
        }
      break;
    case 'l':







|
|

|







64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
parse_opt (int key, char *arg, struct argp_state *state)
{
  struct arguments *arguments = state->input;
  unsigned long int size;
  switch (key)
    {
    case 'b':
      size = arg ? strtoul (arg, NULL, 10) : 100L;
      if (size > SIZE_MAX || size <= 0)
        {
          arguments->num_buckets = SIZE_MAX;
        }
      else
        {
          arguments->num_buckets = (size_t)size;
        }
      break;
    case 'l':

Changes to src/zdbc.h.

1
2
3
4
5
6
7
8
9
10
..
26
27
28
29
30
31
32

33
34
35
36
37
38
39
40
/*  zdbc.h

    Copyright © 2013 Brandon Invergo <brandon@invergo.net>

    This file is part of zeptodb

    zeptodb is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
................................................................................

#include <string.h>
#include "error.h"
#include "argp.h"
#include <signal.h>
#include <stdbool.h>
#include <stdlib.h>


#include "zdb.h"

char *program_name = "zdbc";

void termination_handler (int);

#endif


|







 







>








1
2
3
4
5
6
7
8
9
10
..
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*  zdbc.h

    Copyright © 2013, 2016 Brandon Invergo <brandon@invergo.net>

    This file is part of zeptodb

    zeptodb is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
................................................................................

#include <string.h>
#include "error.h"
#include "argp.h"
#include <signal.h>
#include <stdbool.h>
#include <stdlib.h>
#include <stdint.h>

#include "zdb.h"

char *program_name = "zdbc";

void termination_handler (int);

#endif