replace str->str & g_string_free with g_string_free_and_steal

solving unused warning in GLib 2.76
This commit is contained in:
Ailin Nemui 2025-07-22 11:40:04 +02:00
commit 8eee36d1ea
20 changed files with 73 additions and 78 deletions

View file

@ -106,9 +106,8 @@ char *ban_get_masks(IRC_CHANNEL_REC *channel, const char *nicks, int ban_type)
if (str->len > 0)
g_string_truncate(str, str->len-1);
ret = str->str;
g_string_free(str, FALSE);
return ret;
ret = g_string_free_and_steal(str);
return ret;
}
void ban_set(IRC_CHANNEL_REC *channel, const char *bans, int ban_type)

View file

@ -874,8 +874,7 @@ char *irc_server_get_channels(IRC_SERVER_REC *server, int rejoin_channels_mode)
if (use_keys) g_string_append_printf(chans, " %s", keys->str);
}
ret = chans->str;
g_string_free(chans, FALSE);
ret = g_string_free_and_steal(chans);
g_string_free(keys, TRUE);
return ret;

View file

@ -21,6 +21,7 @@
#include "module.h"
#include <irssi/src/core/signals.h>
#include <irssi/src/core/settings.h>
#include <irssi/src/core/misc.h>
#include <irssi/src/irc/core/irc-commands.h>
#include <irssi/src/irc/core/irc-servers.h>
@ -443,8 +444,7 @@ char *modes_join(IRC_SERVER_REC *server, const char *old,
}
g_free(dup);
modestr = newmode->str;
g_string_free(newmode, FALSE);
modestr = g_string_free_and_steal(newmode);
return modestr;
}
@ -755,8 +755,7 @@ static char *get_nicks(IRC_SERVER_REC *server, WI_ITEM_REC *item,
}
if (str->len > 0) g_string_truncate(str, str->len-1);
ret = str->str;
g_string_free(str, FALSE);
ret = g_string_free_and_steal(str);
g_strfreev(matches);
cmd_params_free(free_arg);

View file

@ -88,8 +88,7 @@ static char *dcc_get_rename_file(const char *fname)
num++;
} while (stat(newname->str, &statbuf) == 0);
ret = newname->str;
g_string_free(newname, FALSE);
ret = g_string_free_and_steal(newname);
return ret;
}
@ -416,8 +415,7 @@ char *get_file_name(char **params, int fileparams)
out = g_string_append(out, params[pos]);
}
ret = out->str;
g_string_free(out, FALSE);
ret = g_string_free_and_steal(out);
return ret;
}