/* gdbmstore.c - Add a new key/data pair to the database. */
/* This file is part of GDBM, the GNU data base manager.
- Copyright (C) 1990, 1991, 1993, 2007, 2011 Free Software Foundation,
+ Copyright (C) 1990, 1991, 1993, 2007, 2011, 2013 Free Software Foundation,
Inc.
GDBM is free software; you can redistribute it and/or modify
/* Get the file address for the new space.
(Current bucket's free space is first place to look.) */
if (file_adr == 0)
- {
- file_adr = _gdbm_alloc (dbf, new_size);
- }
+ file_adr = _gdbm_alloc (dbf, new_size);
/* If this is a new entry in the bucket, we need to do special things. */
if (elem_loc == -1)
/* Find space to insert into bucket and set elem_loc to that place. */
elem_loc = new_hash_val % dbf->header->bucket_elems;
while (dbf->bucket->h_table[elem_loc].hash_value != -1)
- { elem_loc = (elem_loc + 1) % dbf->header->bucket_elems; }
+ elem_loc = (elem_loc + 1) % dbf->header->bucket_elems;
/* We now have another element in the bucket. Add the new information.*/
- dbf->bucket->count += 1;
+ dbf->bucket->count++;
dbf->bucket->h_table[elem_loc].hash_value = new_hash_val;
memcpy (dbf->bucket->h_table[elem_loc].key_start, key.dptr,
(SMALL < key.dsize ? SMALL : key.dsize));
/* Write the data to the file. */
file_pos = __lseek (dbf, file_adr, SEEK_SET);
- if (file_pos != file_adr) _gdbm_fatal (dbf, _("lseek error"));
+ if (file_pos != file_adr)
+ _gdbm_fatal (dbf, _("lseek error"));
rc = _gdbm_full_write (dbf, key.dptr, key.dsize);
if (rc)
_gdbm_fatal (dbf, gdbm_strerror (rc));