mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Use null check convention in jid.c
This commit is contained in:
parent
1bfaa49fb3
commit
4c78534be0
10
src/jid.c
10
src/jid.c
@ -80,12 +80,12 @@ jid_create(const gchar * const str)
|
|||||||
gchar *domain_start = trimmed;
|
gchar *domain_start = trimmed;
|
||||||
|
|
||||||
|
|
||||||
if (atp != NULL) {
|
if (atp) {
|
||||||
result->localpart = g_utf8_substring(trimmed, 0, g_utf8_pointer_to_offset(trimmed, atp));
|
result->localpart = g_utf8_substring(trimmed, 0, g_utf8_pointer_to_offset(trimmed, atp));
|
||||||
domain_start = atp + 1;
|
domain_start = atp + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (slashp != NULL) {
|
if (slashp) {
|
||||||
result->resourcepart = g_strdup(slashp + 1);
|
result->resourcepart = g_strdup(slashp + 1);
|
||||||
result->domainpart = g_utf8_substring(domain_start, 0, g_utf8_pointer_to_offset(domain_start, slashp));
|
result->domainpart = g_utf8_substring(domain_start, 0, g_utf8_pointer_to_offset(domain_start, slashp));
|
||||||
char *barejidraw = g_utf8_substring(trimmed, 0, g_utf8_pointer_to_offset(trimmed, slashp));
|
char *barejidraw = g_utf8_substring(trimmed, 0, g_utf8_pointer_to_offset(trimmed, slashp));
|
||||||
@ -120,7 +120,7 @@ jid_create_from_bare_and_resource(const char * const room, const char * const ni
|
|||||||
void
|
void
|
||||||
jid_destroy(Jid *jid)
|
jid_destroy(Jid *jid)
|
||||||
{
|
{
|
||||||
if (jid != NULL) {
|
if (jid) {
|
||||||
g_free(jid->str);
|
g_free(jid->str);
|
||||||
g_free(jid->localpart);
|
g_free(jid->localpart);
|
||||||
g_free(jid->domainpart);
|
g_free(jid->domainpart);
|
||||||
@ -169,8 +169,8 @@ get_nick_from_full_jid(const char * const full_room_jid)
|
|||||||
char **tokens = g_strsplit(full_room_jid, "/", 0);
|
char **tokens = g_strsplit(full_room_jid, "/", 0);
|
||||||
char *nick_part = NULL;
|
char *nick_part = NULL;
|
||||||
|
|
||||||
if (tokens != NULL) {
|
if (tokens) {
|
||||||
if (tokens[0] != NULL && tokens[1] != NULL) {
|
if (tokens[0] && tokens[1]) {
|
||||||
nick_part = strdup(tokens[1]);
|
nick_part = strdup(tokens[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user