MCPcopy Create free account
hub / github.com/CloverHackyColor/CloverBootloader / getValueForStringTableKey

Function getValueForStringTableKey

Trash/stringTable.c:149–192  ·  view source on GitHub ↗

looks in table for strings of format << "key" = "value"; >> or << "key"; >>

Source from the content-addressed store, hash-verified

147// looks in table for strings of format << "key" = "value"; >>
148// or << "key"; >>
149BOOL getValueForStringTableKey(char *table, char *key, char **val, INTN *size)
150{
151 INTN keyLength;
152 char *tableKey;
153
154 do
155 {
156 eatThru('\"',&table);
157 tableKey = table;
158 keyLength = strlen(key);
159 if (keyLength &&
160 (stringLength(table,1) == keyLength) &&
161 (keyncmp(key, table, keyLength) == 0))
162 {
163 INTN c;
164
165 /* found the key; now look for either
166 * '=' or ';'
167 */
168 while (c = *table) {
169 ++table;
170 if (c == '\\') {
171 ++table;
172 continue;
173 } else if (c == '=' || c == ';') {
174 break;
175 }
176 }
177 if (c == ';') {
178 table = tableKey;
179 } else {
180 eatThru('\"',&table);
181 }
182 *val = table;
183 *size = stringLength(table,0);
184 return YES;
185 }
186
187 eatThru(';',&table);
188
189 } while (*table);
190
191 return NO;
192}
193
194
195/*

Callers 3

getValueForKeyFunction · 0.85
bundleLongNameFunction · 0.85

Calls 4

eatThruFunction · 0.85
stringLengthFunction · 0.85
keyncmpFunction · 0.85
strlenFunction · 0.50

Tested by

no test coverage detected