diff options
author | Michael Vetter <jubalh@iodoru.org> | 2021-03-30 17:38:13 +0200 |
---|---|---|
committer | Michael Vetter <jubalh@iodoru.org> | 2021-03-30 17:38:13 +0200 |
commit | 1ec606540eb0f474f3d968d3566a7c56d778a367 (patch) | |
tree | bfe33ebccfc5f2e020a2bcf4908edbbfcc5791f4 /src/xmpp/stanza.c | |
parent | 3c1e4bac3ae640bc4c451d7d4a1c06146e13a15a (diff) | |
download | profani-tty-1ec606540eb0f474f3d968d3566a7c56d778a367.tar.gz |
Get rid of asprintf and _GNU_SOURCE define
_GNU_SOURCE was even in some files where it was not needed at all (http*). Let's replace asprintf() with g_strdup_printf().
Diffstat (limited to 'src/xmpp/stanza.c')
-rw-r--r-- | src/xmpp/stanza.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/xmpp/stanza.c b/src/xmpp/stanza.c index 96a99960..235a7dee 100644 --- a/src/xmpp/stanza.c +++ b/src/xmpp/stanza.c @@ -33,8 +33,6 @@ * */ -#define _GNU_SOURCE 1 - #include "config.h" #ifdef HAVE_GIT_VERSION @@ -242,10 +240,10 @@ stanza_create_http_upload_request(xmpp_ctx_t* ctx, const char* const id, xmpp_stanza_set_attribute(request, STANZA_ATTR_FILENAME, basename(filename_cpy)); free(filename_cpy); - char* filesize = NULL; - if (asprintf(&filesize, "%jd", (intmax_t)(upload->filesize)) != -1) { + gchar* filesize = g_strdup_printf("%jd", (intmax_t)(upload->filesize)); + if (filesize) { xmpp_stanza_set_attribute(request, STANZA_ATTR_SIZE, filesize); - free(filesize); + g_free(filesize); } xmpp_stanza_set_attribute(request, STANZA_ATTR_CONTENTTYPE, upload->mime_type); |