Removed
Link Here
|
1 |
--- src/value.c.orig 2018-11-26 08:10:21 UTC |
2 |
+++ src/value.c |
3 |
@@ -374,20 +374,20 @@ size_t json_array_size(const json_t *json) |
4 |
return json_to_array(json)->entries; |
5 |
} |
6 |
|
7 |
-json_t *json_array_get(const json_t *json, size_t index) |
8 |
+json_t *json_array_get(const json_t *json, size_t idx) |
9 |
{ |
10 |
json_array_t *array; |
11 |
if(!json_is_array(json)) |
12 |
return NULL; |
13 |
array = json_to_array(json); |
14 |
|
15 |
- if(index >= array->entries) |
16 |
+ if(idx >= array->entries) |
17 |
return NULL; |
18 |
|
19 |
- return array->table[index]; |
20 |
+ return array->table[idx]; |
21 |
} |
22 |
|
23 |
-int json_array_set_new(json_t *json, size_t index, json_t *value) |
24 |
+int json_array_set_new(json_t *json, size_t idx, json_t *value) |
25 |
{ |
26 |
json_array_t *array; |
27 |
|
28 |
@@ -401,14 +401,14 @@ int json_array_set_new(json_t *json, size_t index, jso |
29 |
} |
30 |
array = json_to_array(json); |
31 |
|
32 |
- if(index >= array->entries) |
33 |
+ if(idx >= array->entries) |
34 |
{ |
35 |
json_decref(value); |
36 |
return -1; |
37 |
} |
38 |
|
39 |
- json_decref(array->table[index]); |
40 |
- array->table[index] = value; |
41 |
+ json_decref(array->table[idx]); |
42 |
+ array->table[idx] = value; |
43 |
|
44 |
return 0; |
45 |
} |
46 |
@@ -480,7 +480,7 @@ int json_array_append_new(json_t *json, json_t *value) |
47 |
return 0; |
48 |
} |
49 |
|
50 |
-int json_array_insert_new(json_t *json, size_t index, json_t *value) |
51 |
+int json_array_insert_new(json_t *json, size_t idx, json_t *value) |
52 |
{ |
53 |
json_array_t *array; |
54 |
json_t **old_table; |
55 |
@@ -494,7 +494,7 @@ int json_array_insert_new(json_t *json, size_t index, |
56 |
} |
57 |
array = json_to_array(json); |
58 |
|
59 |
- if(index > array->entries) { |
60 |
+ if(idx > array->entries) { |
61 |
json_decref(value); |
62 |
return -1; |
63 |
} |
64 |
@@ -506,21 +506,21 @@ int json_array_insert_new(json_t *json, size_t index, |
65 |
} |
66 |
|
67 |
if(old_table != array->table) { |
68 |
- array_copy(array->table, 0, old_table, 0, index); |
69 |
- array_copy(array->table, index + 1, old_table, index, |
70 |
- array->entries - index); |
71 |
+ array_copy(array->table, 0, old_table, 0, idx); |
72 |
+ array_copy(array->table, idx + 1, old_table, idx, |
73 |
+ array->entries - idx); |
74 |
jsonp_free(old_table); |
75 |
} |
76 |
else |
77 |
- array_move(array, index + 1, index, array->entries - index); |
78 |
+ array_move(array, idx + 1, idx, array->entries - idx); |
79 |
|
80 |
- array->table[index] = value; |
81 |
+ array->table[idx] = value; |
82 |
array->entries++; |
83 |
|
84 |
return 0; |
85 |
} |
86 |
|
87 |
-int json_array_remove(json_t *json, size_t index) |
88 |
+int json_array_remove(json_t *json, size_t idx) |
89 |
{ |
90 |
json_array_t *array; |
91 |
|
92 |
@@ -528,14 +528,14 @@ int json_array_remove(json_t *json, size_t index) |
93 |
return -1; |
94 |
array = json_to_array(json); |
95 |
|
96 |
- if(index >= array->entries) |
97 |
+ if(idx >= array->entries) |
98 |
return -1; |
99 |
|
100 |
- json_decref(array->table[index]); |
101 |
+ json_decref(array->table[idx]); |
102 |
|
103 |
/* If we're removing the last element, nothing has to be moved */ |
104 |
- if(index < array->entries - 1) |
105 |
- array_move(array, index, index + 1, array->entries - index - 1); |
106 |
+ if(idx < array->entries - 1) |
107 |
+ array_move(array, idx, idx + 1, array->entries - idx - 1); |
108 |
|
109 |
array->entries--; |
110 |
|