Closed stoeckmann closed 2 weeks ago
If we're going the allocations-cannot-fail route, I would suggest having "x" helpers, like the following example from gcc docs
// NB: should probably make a macro for the attribute
char *xstrdup (const char *)
__attribute__((malloc (free), returns_nonnull));
Perhaps one can follow them with a macro like below, so any instances get automatically converted. I'd refer whether we want this to @lucasdemarchi though.
#define strdup xstrdup
Not a fan of overriding the libc functions like that. Let's go with this version. Thanks
IMHO one important drawback of mixing "allocation can fail" and "cannot fail" logic is that one needs to re-review them every time they make changes to the code base.
Split off from https://github.com/kmod-project/kmod/pull/123
Removes the unimplemented NOFAIL macro from depmod and adds another strdup NULL check.