Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(742)

Unified Diff: fusl/src/stdlib/bsearch.c

Issue 1714623002: [fusl] clang-format fusl (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: headers too Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: fusl/src/stdlib/bsearch.c
diff --git a/fusl/src/stdlib/bsearch.c b/fusl/src/stdlib/bsearch.c
index 61d89367e7b9140fa7dc067558427dc2aeed223c..f4c484306f92497bcc94e18cfca4ffbb52165404 100644
--- a/fusl/src/stdlib/bsearch.c
+++ b/fusl/src/stdlib/bsearch.c
@@ -1,20 +1,29 @@
#include <stdlib.h>
-void *bsearch(const void *key, const void *base, size_t nel, size_t width, int (*cmp)(const void *, const void *))
-{
- void *try;
- int sign;
- while (nel > 0) {
- try = (char *)base + width*(nel/2);
- sign = cmp(key, try);
- if (!sign) return try;
- else if (nel == 1) break;
- else if (sign < 0)
- nel /= 2;
- else {
- base = try;
- nel -= nel/2;
- }
- }
- return NULL;
+void* bsearch(const void* key,
+ const void* base,
+ size_t nel,
+ size_t width,
+ int (*cmp)(const void*, const void*)) {
+ void* try
+ ;
+ int sign;
+ while (nel > 0) {
+ try
+ = (char*)base + width * (nel / 2);
+ sign = cmp(key, try);
+ if (!sign)
+ return try
+ ;
+ else if (nel == 1)
+ break;
+ else if (sign < 0)
+ nel /= 2;
+ else {
+ base = try
+ ;
+ nel -= nel / 2;
+ }
+ }
+ return NULL;
}

Powered by Google App Engine
This is Rietveld 408576698