mirror of
https://github.com/pkgconf/pkgconf.git
synced 2026-01-26 08:07:53 +00:00
spdxtool: util: clean up strftime buffer usage
Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
This commit is contained in:
parent
36ac187ad5
commit
a32da62aa7
@ -199,25 +199,15 @@ spdxtool_util_get_spdx_id_string(pkgconf_client_t *client, char *part, char *str
|
||||
char *
|
||||
spdxtool_util_get_iso8601_time(time_t *wanted_time)
|
||||
{
|
||||
char *buf = NULL;
|
||||
char buf[PKGCONF_ITEM_SIZE];
|
||||
struct tm *tm_info = gmtime(wanted_time);
|
||||
|
||||
if(!wanted_time)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
buf = calloc(1, 21);
|
||||
|
||||
if(!buf)
|
||||
{
|
||||
pkgconf_error(NULL, "Memory exhausted! Can't create ISO8601 time.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* ISO8061 time with Z at the end */
|
||||
strftime(buf, 21, "%Y-%m-%dT%H:%M:%SZ", tm_info);
|
||||
return buf;
|
||||
/* ISO8601 time with Z at the end */
|
||||
strftime(buf, sizeof buf, "%Y-%m-%dT%H:%M:%SZ", tm_info);
|
||||
return strdup(buf);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user