X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fgdbmstore.c;h=8c6064d93f3a1cb4877bb64237f0fddaa03eb3d7;hb=affed4e4bfaaa42a03da4de101fdf277ac682de4;hp=aedf3754f11b6ff2ad0cd54e7c989aeffb7175ef;hpb=2a5aa8c2d96550c8463ef3714a20b46397f58b52;p=platform%2Fupstream%2Fgdbm.git diff --git a/src/gdbmstore.c b/src/gdbmstore.c index aedf375..8c6064d 100644 --- a/src/gdbmstore.c +++ b/src/gdbmstore.c @@ -1,7 +1,7 @@ /* 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 @@ -104,9 +104,7 @@ gdbm_store (GDBM_FILE dbf, datum key, datum content, int flags) /* 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) @@ -120,10 +118,10 @@ gdbm_store (GDBM_FILE dbf, datum key, datum content, int flags) /* 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)); @@ -137,7 +135,8 @@ gdbm_store (GDBM_FILE dbf, datum key, datum content, int flags) /* 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));