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().
This commit is contained in:
Michael Vetter
2021-03-30 17:38:13 +02:00
parent 3c1e4bac3a
commit 1ec606540e
12 changed files with 97 additions and 104 deletions

View File

@@ -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);