[Geany-Devel] [geany/geany] fbce36: Improve build date conversion code

Colomban Wendling lists.ban at xxxxx
Sun Mar 17 18:38:35 UTC 2013


Le 17/03/2013 18:00, Colomban Wendling a écrit :
> Le 17/03/2013 17:17, Enrico Tröger a écrit :
>> Branch:      refs/heads/master
>> Author:      Enrico Tröger <enrico.troeger at uvena.de>
>> Committer:   Enrico Tröger <enrico.troeger at uvena.de>
>> Date:        Sun, 17 Mar 2013 16:17:09 UTC
>> Commit:      fbce36418256cacee6d52e535e8ee41bfc76db39
>>              https://github.com/geany/geany/commit/fbce36418256cacee6d52e535e8ee41bfc76db39
>>
>> Log Message:
>> -----------
>> Improve build date conversion code
>>
>> Don't use strptime() as it is not very portable, instead use a GDate and use the
>> code also for the date output in --version.
>>
>>
>> [...]
>> +gchar *utils_parse_and_format_build_date(const gchar *input)
>> +{
>> +	gchar date_buf[255];
>> +	GDate *date = utils_parse_date(input);
>> +
>> +	if (date != NULL)
>> +		g_date_strftime(date_buf, sizeof(date_buf), GEANY_TEMPLATES_FORMAT_DATE, date);
>> +		return g_strdup(date_buf);
> 
> Missing braces around if body.  This may be the source of the bug I'm
> reporting in the other mail.
> 
>> +
>> +	return g_strdup(input);
>> +}
> 
> Also, looks like the date var is leaked.

I fixed both issues in
https://github.com/geany/geany/commit/3291c30de570cc49a60fb270c952199a8acbc63d

Now there is no more issues when the locale is set to something else
than C.  With LANG=C I still gets the tons of warnings, but maybe it's
an issue in g_date_set_parse(), I haven't investigated it yet.

Regards,
Colomban


More information about the Devel mailing list