case KEYPRESS(0, 0, CHAR_LINEFEED):
case KEYPRESS(0, 0, CHAR_CARRIAGE_RETURN):
- if (StrCmp(line, line_in) != 0) {
- *line_out = line;
- line = NULL;
- }
+ if (StrCmp(line, line_in) != 0)
+ *line_out = TAKE_PTR(line);
enter = TRUE;
exit = TRUE;
break;
/* If the file we just renamed is the loader path, then let's update that. */
if (StrCmp(entry->loader, old_path) == 0) {
FreePool(entry->loader);
- entry->loader = new_path;
- new_path = NULL;
+ entry->loader = TAKE_PTR(new_path);
}
}
s = PoolPrint(L"%s %s", entry->options, new);
FreePool(entry->options);
entry->options = s;
- } else {
- entry->options = new;
- new = NULL;
- }
+ } else
+ entry->options = TAKE_PTR(new);
continue;
}
s = PoolPrint(L"%s %s", initrd, entry->options);
FreePool(entry->options);
entry->options = s;
- } else {
- entry->options = initrd;
- initrd = NULL;
- }
+ } else
+ entry->options = TAKE_PTR(initrd);
}
entry->device = device;
/* Return buffer directly if it happens to be NUL terminated already */
if (size >= 2 && buf[size-2] == 0 && buf[size-1] == 0) {
- *value = (CHAR16*) buf;
- buf = NULL;
+ *value = (CHAR16*) TAKE_PTR(buf);
return EFI_SUCCESS;
}