Skip to content

Conversation

fbucafusco
Copy link

Fixes nob for when you have this pattern:

#ifdef OPTIM
#define CFLAGS "-O2"
#else
#define CFLAGS ""
#endif
....
cmd_append(&cmd, COMPILER_C, "-c" , "file.c" , CFLAGS , INCLUDES , "-o", "myexec");

When OPTIM is not defined, then CFLAGS is "" and execvp fails.
also works with #define CFLAGS NULL

Also fixes nob_cmd_render.

accepts arguments with empty strings
@@ -957,6 +957,7 @@ NOBDEF void nob_cmd_render(Nob_Cmd cmd, Nob_String_Builder *render)
for (size_t i = 0; i < cmd.count; ++i) {
const char *arg = cmd.items[i];
if (arg == NULL) break;
if( arg[0] == '\0' ) continue;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be a good idea to conform the style to what is around. The spaces after ( and before ).
Less work for Zozin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants