Line 0
Link Here
|
|
|
1 |
diff -ur src/hashtable.c src/hashtable.c |
2 |
--- src/hashtable.c 2010-06-12 19:43:18.000000000 +0000 |
3 |
+++ src/hashtable.c 2011-01-18 10:14:31.000000000 +0000 |
4 |
@@ -104,10 +104,10 @@ |
5 |
{ |
6 |
pair_t *pair; |
7 |
bucket_t *bucket; |
8 |
- unsigned int index; |
9 |
+ unsigned int my_index; |
10 |
|
11 |
- index = hash % num_buckets(hashtable); |
12 |
- bucket = &hashtable->buckets[index]; |
13 |
+ my_index = hash % num_buckets(hashtable); |
14 |
+ bucket = &hashtable->buckets[my_index]; |
15 |
|
16 |
pair = hashtable_find_pair(hashtable, bucket, key, hash); |
17 |
if(!pair) |
18 |
@@ -156,7 +156,7 @@ |
19 |
{ |
20 |
list_t *list, *next; |
21 |
pair_t *pair; |
22 |
- unsigned int i, index, new_size; |
23 |
+ unsigned int i, my_index, new_size; |
24 |
|
25 |
free(hashtable->buckets); |
26 |
|
27 |
@@ -179,8 +179,8 @@ |
28 |
for(; list != &hashtable->list; list = next) { |
29 |
next = list->next; |
30 |
pair = list_to_pair(list); |
31 |
- index = pair->hash % new_size; |
32 |
- insert_to_bucket(hashtable, &hashtable->buckets[index], &pair->list); |
33 |
+ my_index = pair->hash % new_size; |
34 |
+ insert_to_bucket(hashtable, &hashtable->buckets[my_index], &pair->list); |
35 |
} |
36 |
|
37 |
return 0; |
38 |
@@ -216,7 +216,7 @@ |
39 |
unsigned int i; |
40 |
|
41 |
hashtable->size = 0; |
42 |
- hashtable->num_buckets = 0; /* index to primes[] */ |
43 |
+ hashtable->num_buckets = 0; /* my_index to primes[] */ |
44 |
hashtable->buckets = malloc(num_buckets(hashtable) * sizeof(bucket_t)); |
45 |
if(!hashtable->buckets) |
46 |
return -1; |
47 |
@@ -247,7 +247,7 @@ |
48 |
{ |
49 |
pair_t *pair; |
50 |
bucket_t *bucket; |
51 |
- unsigned int hash, index; |
52 |
+ unsigned int hash, my_index; |
53 |
|
54 |
/* rehash if the load ratio exceeds 1 */ |
55 |
if(hashtable->size >= num_buckets(hashtable)) |
56 |
@@ -255,8 +255,8 @@ |
57 |
return -1; |
58 |
|
59 |
hash = hashtable->hash_key(key); |
60 |
- index = hash % num_buckets(hashtable); |
61 |
- bucket = &hashtable->buckets[index]; |
62 |
+ my_index = hash % num_buckets(hashtable); |
63 |
+ bucket = &hashtable->buckets[my_index]; |
64 |
pair = hashtable_find_pair(hashtable, bucket, key, hash); |
65 |
|
66 |
if(pair) |
67 |
diff -ur src/jansson.h src/jansson.h |
68 |
--- src/jansson.h 2010-06-13 17:39:35.000000000 +0000 |
69 |
+++ src/jansson.h 2011-01-18 10:14:47.000000000 +0000 |
70 |
@@ -113,18 +113,18 @@ |
71 |
} |
72 |
|
73 |
unsigned int json_array_size(const json_t *array); |
74 |
-json_t *json_array_get(const json_t *array, unsigned int index); |
75 |
-int json_array_set_new(json_t *array, unsigned int index, json_t *value); |
76 |
+json_t *json_array_get(const json_t *array, unsigned int my_index); |
77 |
+int json_array_set_new(json_t *array, unsigned int my_index, json_t *value); |
78 |
int json_array_append_new(json_t *array, json_t *value); |
79 |
-int json_array_insert_new(json_t *array, unsigned int index, json_t *value); |
80 |
-int json_array_remove(json_t *array, unsigned int index); |
81 |
+int json_array_insert_new(json_t *array, unsigned int my_index, json_t *value); |
82 |
+int json_array_remove(json_t *array, unsigned int my_index); |
83 |
int json_array_clear(json_t *array); |
84 |
int json_array_extend(json_t *array, json_t *other); |
85 |
|
86 |
static JSON_INLINE |
87 |
-int json_array_set(json_t *array, unsigned int index, json_t *value) |
88 |
+int json_array_set(json_t *array, unsigned int my_index, json_t *value) |
89 |
{ |
90 |
- return json_array_set_new(array, index, json_incref(value)); |
91 |
+ return json_array_set_new(array, my_index, json_incref(value)); |
92 |
} |
93 |
|
94 |
static JSON_INLINE |
95 |
@@ -134,9 +134,9 @@ |
96 |
} |
97 |
|
98 |
static JSON_INLINE |
99 |
-int json_array_insert(json_t *array, unsigned int index, json_t *value) |
100 |
+int json_array_insert(json_t *array, unsigned int my_index, json_t *value) |
101 |
{ |
102 |
- return json_array_insert_new(array, index, json_incref(value)); |
103 |
+ return json_array_insert_new(array, my_index, json_incref(value)); |
104 |
} |
105 |
|
106 |
const char *json_string_value(const json_t *string); |
107 |
diff -ur src/jansson.h.in src/jansson.h.in |
108 |
--- src/jansson.h.in 2010-06-12 19:43:18.000000000 +0000 |
109 |
+++ src/jansson.h.in 2011-01-18 10:15:22.000000000 +0000 |
110 |
@@ -113,18 +113,18 @@ |
111 |
} |
112 |
|
113 |
unsigned int json_array_size(const json_t *array); |
114 |
-json_t *json_array_get(const json_t *array, unsigned int index); |
115 |
-int json_array_set_new(json_t *array, unsigned int index, json_t *value); |
116 |
+json_t *json_array_get(const json_t *array, unsigned int my_index); |
117 |
+int json_array_set_new(json_t *array, unsigned int my_index, json_t *value); |
118 |
int json_array_append_new(json_t *array, json_t *value); |
119 |
-int json_array_insert_new(json_t *array, unsigned int index, json_t *value); |
120 |
-int json_array_remove(json_t *array, unsigned int index); |
121 |
+int json_array_insert_new(json_t *array, unsigned int my_index, json_t *value); |
122 |
+int json_array_remove(json_t *array, unsigned int my_index); |
123 |
int json_array_clear(json_t *array); |
124 |
int json_array_extend(json_t *array, json_t *other); |
125 |
|
126 |
static JSON_INLINE |
127 |
-int json_array_set(json_t *array, unsigned int index, json_t *value) |
128 |
+int json_array_set(json_t *array, unsigned int my_index, json_t *value) |
129 |
{ |
130 |
- return json_array_set_new(array, index, json_incref(value)); |
131 |
+ return json_array_set_new(array, my_index, json_incref(value)); |
132 |
} |
133 |
|
134 |
static JSON_INLINE |
135 |
@@ -134,9 +134,9 @@ |
136 |
} |
137 |
|
138 |
static JSON_INLINE |
139 |
-int json_array_insert(json_t *array, unsigned int index, json_t *value) |
140 |
+int json_array_insert(json_t *array, unsigned int my_index, json_t *value) |
141 |
{ |
142 |
- return json_array_insert_new(array, index, json_incref(value)); |
143 |
+ return json_array_insert_new(array, my_index, json_incref(value)); |
144 |
} |
145 |
|
146 |
const char *json_string_value(const json_t *string); |
147 |
diff -ur src/value.c src/value.c |
148 |
--- src/value.c 2010-06-12 19:43:18.000000000 +0000 |
149 |
+++ src/value.c 2011-01-18 10:15:10.000000000 +0000 |
150 |
@@ -388,20 +388,20 @@ |
151 |
return json_to_array(json)->entries; |
152 |
} |
153 |
|
154 |
-json_t *json_array_get(const json_t *json, unsigned int index) |
155 |
+json_t *json_array_get(const json_t *json, unsigned int my_index) |
156 |
{ |
157 |
json_array_t *array; |
158 |
if(!json_is_array(json)) |
159 |
return NULL; |
160 |
array = json_to_array(json); |
161 |
|
162 |
- if(index >= array->entries) |
163 |
+ if(my_index >= array->entries) |
164 |
return NULL; |
165 |
|
166 |
- return array->table[index]; |
167 |
+ return array->table[my_index]; |
168 |
} |
169 |
|
170 |
-int json_array_set_new(json_t *json, unsigned int index, json_t *value) |
171 |
+int json_array_set_new(json_t *json, unsigned int my_index, json_t *value) |
172 |
{ |
173 |
json_array_t *array; |
174 |
|
175 |
@@ -415,14 +415,14 @@ |
176 |
} |
177 |
array = json_to_array(json); |
178 |
|
179 |
- if(index >= array->entries) |
180 |
+ if(my_index >= array->entries) |
181 |
{ |
182 |
json_decref(value); |
183 |
return -1; |
184 |
} |
185 |
|
186 |
- json_decref(array->table[index]); |
187 |
- array->table[index] = value; |
188 |
+ json_decref(array->table[my_index]); |
189 |
+ array->table[my_index] = value; |
190 |
|
191 |
return 0; |
192 |
} |
193 |
@@ -494,7 +494,7 @@ |
194 |
return 0; |
195 |
} |
196 |
|
197 |
-int json_array_insert_new(json_t *json, unsigned int index, json_t *value) |
198 |
+int json_array_insert_new(json_t *json, unsigned int my_index, json_t *value) |
199 |
{ |
200 |
json_array_t *array; |
201 |
json_t **old_table; |
202 |
@@ -508,7 +508,7 @@ |
203 |
} |
204 |
array = json_to_array(json); |
205 |
|
206 |
- if(index > array->entries) { |
207 |
+ if(my_index > array->entries) { |
208 |
json_decref(value); |
209 |
return -1; |
210 |
} |
211 |
@@ -520,21 +520,21 @@ |
212 |
} |
213 |
|
214 |
if(old_table != array->table) { |
215 |
- array_copy(array->table, 0, old_table, 0, index); |
216 |
- array_copy(array->table, index + 1, old_table, index, |
217 |
- array->entries - index); |
218 |
+ array_copy(array->table, 0, old_table, 0, my_index); |
219 |
+ array_copy(array->table, my_index + 1, old_table, my_index, |
220 |
+ array->entries - my_index); |
221 |
free(old_table); |
222 |
} |
223 |
else |
224 |
- array_move(array, index + 1, index, array->entries - index); |
225 |
+ array_move(array, my_index + 1, my_index, array->entries - my_index); |
226 |
|
227 |
- array->table[index] = value; |
228 |
+ array->table[my_index] = value; |
229 |
array->entries++; |
230 |
|
231 |
return 0; |
232 |
} |
233 |
|
234 |
-int json_array_remove(json_t *json, unsigned int index) |
235 |
+int json_array_remove(json_t *json, unsigned int my_index) |
236 |
{ |
237 |
json_array_t *array; |
238 |
|
239 |
@@ -542,12 +542,12 @@ |
240 |
return -1; |
241 |
array = json_to_array(json); |
242 |
|
243 |
- if(index >= array->entries) |
244 |
+ if(my_index >= array->entries) |
245 |
return -1; |
246 |
|
247 |
- json_decref(array->table[index]); |
248 |
+ json_decref(array->table[my_index]); |
249 |
|
250 |
- array_move(array, index, index + 1, array->entries - index); |
251 |
+ array_move(array, my_index, my_index + 1, array->entries - my_index); |
252 |
array->entries--; |
253 |
|
254 |
return 0; |