summaryrefslogtreecommitdiff
path: root/src/hashtab.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-01-30 17:24:07 +0100
committerBram Moolenaar <Bram@vim.org>2016-01-30 17:24:07 +0100
commit68c2f638e65d914dc6e84eb7ce2624f08af525c0 (patch)
tree051b6b7500c6ac80c45cdeff26296c5b7acb88ff /src/hashtab.c
parent66f948e928d5e0cd3123af902aa8ac1613534c94 (diff)
downloadvim-git-68c2f638e65d914dc6e84eb7ce2624f08af525c0.tar.gz
patch 7.4.1208v7.4.1208
Problem: Using old style function declarations. Solution: Change to new style function declarations. (script by Hirohito Higashi)
Diffstat (limited to 'src/hashtab.c')
-rw-r--r--src/hashtab.c64
1 files changed, 22 insertions, 42 deletions
diff --git a/src/hashtab.c b/src/hashtab.c
index a4bce6503..d1ba2c952 100644
--- a/src/hashtab.c
+++ b/src/hashtab.c
@@ -49,7 +49,7 @@ static int hash_may_resize(hashtab_T *ht, int minitems);
* Returns NULL when out of memory.
*/
hashtab_T *
-hash_create()
+hash_create(void)
{
hashtab_T *ht;
@@ -64,8 +64,7 @@ hash_create()
* Initialize an empty hash table.
*/
void
-hash_init(ht)
- hashtab_T *ht;
+hash_init(hashtab_T *ht)
{
/* This zeroes all "ht_" entries and all the "hi_key" in "ht_smallarray". */
vim_memset(ht, 0, sizeof(hashtab_T));
@@ -78,8 +77,7 @@ hash_init(ht)
* If "ht" is not freed then you should call hash_init() next!
*/
void
-hash_clear(ht)
- hashtab_T *ht;
+hash_clear(hashtab_T *ht)
{
if (ht->ht_array != ht->ht_smallarray)
vim_free(ht->ht_array);
@@ -91,9 +89,7 @@ hash_clear(ht)
* memory to the location of the key (it's always positive).
*/
void
-hash_clear_all(ht, off)
- hashtab_T *ht;
- int off;
+hash_clear_all(hashtab_T *ht, int off)
{
long todo;
hashitem_T *hi;
@@ -119,9 +115,7 @@ hash_clear_all(ht, off)
* (adding, setting or removing an item)!
*/
hashitem_T *
-hash_find(ht, key)
- hashtab_T *ht;
- char_u *key;
+hash_find(hashtab_T *ht, char_u *key)
{
return hash_lookup(ht, key, hash_hash(key));
}
@@ -130,10 +124,7 @@ hash_find(ht, key)
* Like hash_find(), but caller computes "hash".
*/
hashitem_T *
-hash_lookup(ht, key, hash)
- hashtab_T *ht;
- char_u *key;
- hash_T hash;
+hash_lookup(hashtab_T *ht, char_u *key, hash_T hash)
{
hash_T perturb;
hashitem_T *freeitem;
@@ -195,7 +186,7 @@ hash_lookup(ht, key, hash)
* Called when exiting.
*/
void
-hash_debug_results()
+hash_debug_results(void)
{
#ifdef HT_DEBUG
fprintf(stderr, "\r\n\r\n\r\n\r\n");
@@ -211,9 +202,7 @@ hash_debug_results()
* Returns FAIL when out of memory or the key is already present.
*/
int
-hash_add(ht, key)
- hashtab_T *ht;
- char_u *key;
+hash_add(hashtab_T *ht, char_u *key)
{
hash_T hash = hash_hash(key);
hashitem_T *hi;
@@ -234,11 +223,11 @@ hash_add(ht, key)
* Returns OK or FAIL (out of memory).
*/
int
-hash_add_item(ht, hi, key, hash)
- hashtab_T *ht;
- hashitem_T *hi;
- char_u *key;
- hash_T hash;
+hash_add_item(
+ hashtab_T *ht,
+ hashitem_T *hi,
+ char_u *key,
+ hash_T hash)
{
/* If resizing failed before and it fails again we can't add an item. */
if (ht->ht_error && hash_may_resize(ht, 0) == FAIL)
@@ -265,9 +254,7 @@ hash_add_item(ht, hi, key, hash)
* "hi" is invalid after this!
*/
void
-hash_set(hi, key)
- hashitem_T *hi;
- char_u *key;
+hash_set(hashitem_T *hi, char_u *key)
{
hi->hi_key = key;
}
@@ -279,9 +266,7 @@ hash_set(hi, key)
* The caller must take care of freeing the item itself.
*/
void
-hash_remove(ht, hi)
- hashtab_T *ht;
- hashitem_T *hi;
+hash_remove(hashtab_T *ht, hashitem_T *hi)
{
--ht->ht_used;
hi->hi_key = HI_KEY_REMOVED;
@@ -294,8 +279,7 @@ hash_remove(ht, hi)
* Must call hash_unlock() later.
*/
void
-hash_lock(ht)
- hashtab_T *ht;
+hash_lock(hashtab_T *ht)
{
++ht->ht_locked;
}
@@ -307,9 +291,7 @@ hash_lock(ht)
* Must call hash_unlock() later.
*/
void
-hash_lock_size(ht, size)
- hashtab_T *ht;
- int size;
+hash_lock_size(hashtab_T *ht, int size)
{
(void)hash_may_resize(ht, size);
++ht->ht_locked;
@@ -322,8 +304,7 @@ hash_lock_size(ht, size)
* This must balance a call to hash_lock().
*/
void
-hash_unlock(ht)
- hashtab_T *ht;
+hash_unlock(hashtab_T *ht)
{
--ht->ht_locked;
(void)hash_may_resize(ht, 0);
@@ -335,9 +316,9 @@ hash_unlock(ht)
* Returns OK or FAIL (out of memory).
*/
static int
-hash_may_resize(ht, minitems)
- hashtab_T *ht;
- int minitems; /* minimal number of items */
+hash_may_resize(
+ hashtab_T *ht,
+ int minitems) /* minimal number of items */
{
hashitem_T temparray[HT_INIT_SIZE];
hashitem_T *oldarray, *newarray;
@@ -481,8 +462,7 @@ hash_may_resize(ht, minitems)
* lower the percentage the better.
*/
hash_T
-hash_hash(key)
- char_u *key;
+hash_hash(char_u *key)
{
hash_T hash;
char_u *p;