Code cleanup

This commit is contained in:
Pierre Pronchery 2019-02-12 15:56:14 +01:00
parent 75f16c92b7
commit 5dd8c6bf64

View File

@ -3064,19 +3064,17 @@ static int _makefile_output_variable(Makefile * makefile, String const * name,
String const * value) String const * value)
{ {
int res; int res;
char const * align; size_t len;
char const * equals;
if(makefile->fp == NULL) if(makefile->fp == NULL)
return 0; return 0;
if(name == NULL) if(name == NULL || (len = strlen(name)) == 0)
return -1; return -1;
if(value == NULL) if(value == NULL)
value = ""; value = "";
align = (strlen(name) >= 8) ? "" : "\t"; res = _makefile_print(makefile, "%s%s%s%s\n", name,
equals = (strlen(value) > 0) ? "= " : "="; (len >= 8) ? "" : "\t",
res = _makefile_print(makefile, "%s%s%s%s\n", name, align, equals, (strlen(value) > 0) ? "= " : "=", value);
value);
return (res >= 0) ? 0 : -1; return (res >= 0) ? 0 : -1;
} }