Skip to content

Commit 50fc13a

Browse files
eloycotoitchyny
andauthored
styleStyle fixes from suggestions.
Co-authored-by: itchyny <[email protected]>
1 parent 949b647 commit 50fc13a

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/builtin.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -792,7 +792,7 @@ static jv f_bsearch(jq_state *jq, jv input, jv target) {
792792
return jv_number(-1);
793793
} else if (len == 1) {
794794
int result = jv_cmp(target, jv_array_get(input, 0));
795-
if (result == 0 ) {
795+
if (result == 0) {
796796
return jv_number(0);
797797
} else if (result > 0) {
798798
return jv_number(-2);
@@ -804,26 +804,26 @@ static jv f_bsearch(jq_state *jq, jv input, jv target) {
804804
int start = 0;
805805
int end = len - 1;
806806
jv answer = jv_null();
807-
while (start <end) {
807+
while (start < end) {
808808
int mid = (start + end) / 2;
809809
int result = jv_cmp(jv_copy(target), jv_array_get(jv_copy(input), mid));
810810
if (result == 0) {
811811
answer = jv_number(mid);
812812
break;
813-
} else if (start == end ) {
813+
} else if (start == end) {
814814
answer = jv_number(-1);
815815
break;
816-
} else if (result < 0 ) {
817-
end = mid -1;
816+
} else if (result < 0) {
817+
end = mid - 1;
818818
} else {
819-
start = mid +1;
819+
start = mid + 1;
820820
}
821821
}
822822
if (jv_get_kind(answer) == JV_KIND_NULL) {
823823
int result = jv_cmp(target, jv_array_get(jv_copy(input), start));
824824
if (result < 0) {
825825
answer = jv_number(-1 - start);
826-
}else {
826+
} else {
827827
answer = jv_number(-2 - start);
828828
}
829829
} else {

0 commit comments

Comments
 (0)