mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-21 10:36:21 +00:00
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:
@@ -34,8 +34,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE 1
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <errno.h>
|
||||
@@ -529,13 +527,14 @@ _unique_filename(const char* filename)
|
||||
|
||||
unsigned int i = 0;
|
||||
while (g_file_test(unique, G_FILE_TEST_EXISTS)) {
|
||||
free(unique);
|
||||
g_free(unique);
|
||||
|
||||
if (i > 1000) { // Give up after 1000 attempts.
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (asprintf(&unique, "%s.%u", filename, i) < 0) {
|
||||
unique = g_strdup_printf("%s.%u", filename, i);
|
||||
if (!unique) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user