cleanup: variable reinitializations

master
Michael Santos 8 months ago
parent 56ef393916
commit f987fd95e7

@ -324,7 +324,7 @@ int xmppipe_connect_init(xmppipe_state_t *state) {
} }
int xmppipe_stream_init(xmppipe_state_t *state) { int xmppipe_stream_init(xmppipe_state_t *state) {
xmpp_stanza_t *enable = NULL; xmpp_stanza_t *enable;
if (state->sm_request_interval == 0) if (state->sm_request_interval == 0)
return 0; return 0;
@ -476,9 +476,9 @@ int handle_disco_items(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza,
for (item = xmpp_stanza_get_children(query); item != NULL; for (item = xmpp_stanza_get_children(query); item != NULL;
item = xmpp_stanza_get_next(item)) { item = xmpp_stanza_get_next(item)) {
xmpp_stanza_t *iq, *reply; xmpp_stanza_t *iq, *reply;
const char *jid = NULL; const char *jid;
const char *name = NULL; const char *name;
char *id = NULL; char *id;
name = xmpp_stanza_get_name(item); name = xmpp_stanza_get_name(item);
if (name == NULL) if (name == NULL)

@ -39,7 +39,7 @@ const char *const xmppipe_states[] = {"XMPPIPE_S_DISCONNECTED",
static char *xmppipe_join(char *prefix, char *delimiter, char *suffix); static char *xmppipe_join(char *prefix, char *delimiter, char *suffix);
int xmppipe_set_nonblock(int fd) { int xmppipe_set_nonblock(int fd) {
int flags = 0; int flags;
flags = fcntl(fd, F_GETFD); flags = fcntl(fd, F_GETFD);
if (flags < 0) if (flags < 0)
@ -61,7 +61,7 @@ char *xmppipe_getenv(const char *s) {
} }
char *xmppipe_strdup(const char *s) { char *xmppipe_strdup(const char *s) {
char *buf = NULL; char *buf;
if (s == NULL) if (s == NULL)
errx(2, "invalid string"); errx(2, "invalid string");
@ -74,7 +74,7 @@ char *xmppipe_strdup(const char *s) {
} }
void *xmppipe_malloc(size_t size) { void *xmppipe_malloc(size_t size) {
char *buf = NULL; char *buf;
if (size == 0 || size > 0xffff) if (size == 0 || size > 0xffff)
errx(2, "invalid size: %zd", size); errx(2, "invalid size: %zd", size);
@ -87,7 +87,7 @@ void *xmppipe_malloc(size_t size) {
} }
void *xmppipe_calloc(size_t nmemb, size_t size) { void *xmppipe_calloc(size_t nmemb, size_t size) {
char *buf = NULL; char *buf;
buf = calloc(nmemb, size); buf = calloc(nmemb, size);
if (buf == NULL) if (buf == NULL)
@ -251,7 +251,7 @@ static char *xmppipe_join(char *prefix, char *delimiter, char *suffix) {
} }
char *xmppipe_roomname(char *label) { char *xmppipe_roomname(char *label) {
char *buf = NULL; char *buf;
size_t len = 64; size_t len = 64;
char name[16] = {0}; char name[16] = {0};

Loading…
Cancel
Save