Skip to content

Commit

Permalink
improve array to floats
Browse files Browse the repository at this point in the history
  • Loading branch information
recp committed Dec 1, 2019
1 parent 94b3cbe commit 269cc45
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions include/json/impl/impl_json.h
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ json_array_float(float * __restrict dest,
bool sourceIsReversed) {
json_array_t *arr;
json_t *item;
int count, i, diff;
int count, i;

/* fill the array with default value if object is not an array */
if (!(arr = json_array(object))) {
Expand All @@ -331,7 +331,6 @@ json_array_float(float * __restrict dest,

count = arr->count;
item = arr->base.value;
diff = abs(desiredCount - count);

if (desiredCount > 0 && count > desiredCount)
count = desiredCount;
Expand All @@ -350,9 +349,8 @@ json_array_float(float * __restrict dest,
item = item->next;
}

while (count) {
while (count)
dest[--count] = defaultValue;
}
} else {
i = 0;
while (item) {
Expand Down

0 comments on commit 269cc45

Please sign in to comment.