mirror of
https://github.com/linux-msm/qbootctl.git
synced 2026-02-25 13:13:44 -08:00
Revert "Use scope-based memory management for malloc, free, open, close, etc."
This commit introduced a lot of changes and seems to have caused a few
issues, including breaking crc32 generation. Revert it for now with the
intention to reimplement some of the improvements.
This reverts commit 9d7600df51.
This commit is contained in:
22
qbootctl.cpp
22
qbootctl.cpp
@@ -41,23 +41,17 @@ bool isslotnum(const char* str)
|
||||
return strspn(str, "01") == strlen(str);
|
||||
}
|
||||
|
||||
static void unexpectedSlot(const char *arg)
|
||||
{
|
||||
fprintf(stderr, "Expected slot not '%s'\n", arg);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
unsigned parseSlot(const char* arg)
|
||||
{
|
||||
char *end;
|
||||
int slot;
|
||||
if (!isslot(arg))
|
||||
unexpectedSlot(arg);
|
||||
|
||||
if (!isslot(arg)) {
|
||||
goto fail;
|
||||
}
|
||||
if (isslotnum(arg)) {
|
||||
slot = (int)strtol(arg, &end, 10);
|
||||
if (end == arg)
|
||||
unexpectedSlot(arg);
|
||||
goto fail;
|
||||
} else {
|
||||
switch (arg[0]) {
|
||||
case 'a':
|
||||
@@ -69,11 +63,17 @@ unsigned parseSlot(const char* arg)
|
||||
slot = 1;
|
||||
break;
|
||||
default:
|
||||
unexpectedSlot(arg);
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
return (unsigned)slot;
|
||||
|
||||
fail:
|
||||
fprintf(stderr,
|
||||
"Expected slot not '%s'\n",
|
||||
arg);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int usage()
|
||||
|
||||
Reference in New Issue
Block a user