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)
{
int res;
char const * align;
char const * equals;
size_t len;
if(makefile->fp == NULL)
return 0;
if(name == NULL)
if(name == NULL || (len = strlen(name)) == 0)
return -1;
if(value == NULL)
value = "";
align = (strlen(name) >= 8) ? "" : "\t";
equals = (strlen(value) > 0) ? "= " : "=";
res = _makefile_print(makefile, "%s%s%s%s\n", name, align, equals,
value);
res = _makefile_print(makefile, "%s%s%s%s\n", name,
(len >= 8) ? "" : "\t",
(strlen(value) > 0) ? "= " : "=", value);
return (res >= 0) ? 0 : -1;
}