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

Side by Side Diff: fusl/src/env/getenv.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 unified diff | Download patch
OLDNEW
1 #include <stdlib.h> 1 #include <stdlib.h>
2 #include <string.h> 2 #include <string.h>
3 #include "libc.h" 3 #include "libc.h"
4 4
5 char *getenv(const char *name) 5 char* getenv(const char* name) {
6 { 6 int i;
7 » int i; 7 size_t l = strlen(name);
8 » size_t l = strlen(name); 8 if (!__environ || !*name || strchr(name, '='))
9 » if (!__environ || !*name || strchr(name, '=')) return NULL; 9 return NULL;
10 » for (i=0; __environ[i] && (strncmp(name, __environ[i], l) 10 for (i = 0; __environ[i] &&
11 » » || __environ[i][l] != '='); i++); 11 (strncmp(name, __environ[i], l) || __environ[i][l] != '=');
12 » if (__environ[i]) return __environ[i] + l+1; 12 i++)
13 » return NULL; 13 ;
14 if (__environ[i])
15 return __environ[i] + l + 1;
16 return NULL;
14 } 17 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698