1
0
Fork 0

Changed Jid typedef to be explicit pointer

This commit is contained in:
James Booth 2013-01-13 00:05:25 +00:00
parent 7733af1293
commit 1cc33cc491
4 changed files with 22 additions and 21 deletions

View File

@ -26,10 +26,10 @@
#include "jid.h"
Jid
Jid *
jid_create(const gchar * const str)
{
Jid result = NULL;
Jid *result = NULL;
if (str == NULL) {
return NULL;

View File

@ -33,9 +33,9 @@ struct jid_t {
char *fulljid;
};
typedef struct jid_t *Jid;
typedef struct jid_t Jid;
Jid jid_create(const gchar * const str);
Jid * jid_create(const gchar * const str);
gboolean jid_is_room(const char * const room_jid);
char * create_full_room_jid(const char * const room,

View File

@ -29,6 +29,7 @@
#include "prof_autocomplete.h"
typedef struct _muc_room_t {
char *room; // e.g. test@conference.server
char *nick; // e.g. Some User
char *subject;

View File

@ -5,103 +5,103 @@
void create_jid_from_null_returns_null(void)
{
Jid result = jid_create(NULL);
Jid *result = jid_create(NULL);
assert_is_null(result);
}
void create_jid_from_empty_string_returns_null(void)
{
Jid result = jid_create("");
Jid *result = jid_create("");
assert_is_null(result);
}
void create_jid_from_full_returns_full(void)
{
Jid result = jid_create("myuser@mydomain/laptop");
Jid *result = jid_create("myuser@mydomain/laptop");
assert_string_equals("myuser@mydomain/laptop", result->fulljid);
}
void create_jid_from_full_returns_bare(void)
{
Jid result = jid_create("myuser@mydomain/laptop");
Jid *result = jid_create("myuser@mydomain/laptop");
assert_string_equals("myuser@mydomain", result->barejid);
}
void create_jid_from_full_returns_resourcepart(void)
{
Jid result = jid_create("myuser@mydomain/laptop");
Jid *result = jid_create("myuser@mydomain/laptop");
assert_string_equals("laptop", result->resourcepart);
}
void create_jid_from_full_returns_localpart(void)
{
Jid result = jid_create("myuser@mydomain/laptop");
Jid *result = jid_create("myuser@mydomain/laptop");
assert_string_equals("myuser", result->localpart);
}
void create_jid_from_full_returns_domainpart(void)
{
Jid result = jid_create("myuser@mydomain/laptop");
Jid *result = jid_create("myuser@mydomain/laptop");
assert_string_equals("mydomain", result->domainpart);
}
void create_jid_from_full_nolocal_returns_full(void)
{
Jid result = jid_create("mydomain/laptop");
Jid *result = jid_create("mydomain/laptop");
assert_string_equals("mydomain/laptop", result->fulljid);
}
void create_jid_from_full_nolocal_returns_bare(void)
{
Jid result = jid_create("mydomain/laptop");
Jid *result = jid_create("mydomain/laptop");
assert_string_equals("mydomain", result->barejid);
}
void create_jid_from_full_nolocal_returns_resourcepart(void)
{
Jid result = jid_create("mydomain/laptop");
Jid *result = jid_create("mydomain/laptop");
assert_string_equals("laptop", result->resourcepart);
}
void create_jid_from_full_nolocal_returns_domainpart(void)
{
Jid result = jid_create("mydomain/laptop");
Jid *result = jid_create("mydomain/laptop");
assert_string_equals("mydomain", result->domainpart);
}
void create_jid_from_full_nolocal_returns_null_localpart(void)
{
Jid result = jid_create("mydomain/laptop");
Jid *result = jid_create("mydomain/laptop");
assert_is_null(result->localpart);
}
void create_jid_from_bare_returns_null_full(void)
{
Jid result = jid_create("myuser@mydomain");
Jid *result = jid_create("myuser@mydomain");
assert_is_null(result->fulljid);
}
void create_jid_from_bare_returns_null_resource(void)
{
Jid result = jid_create("myuser@mydomain");
Jid *result = jid_create("myuser@mydomain");
assert_is_null(result->resourcepart);
}
void create_jid_from_bare_returns_bare(void)
{
Jid result = jid_create("myuser@mydomain");
Jid *result = jid_create("myuser@mydomain");
assert_string_equals("myuser@mydomain", result->barejid);
}
void create_jid_from_bare_returns_localpart(void)
{
Jid result = jid_create("myuser@mydomain");
Jid *result = jid_create("myuser@mydomain");
assert_string_equals("myuser", result->localpart);
}
void create_jid_from_bare_returns_domainpart(void)
{
Jid result = jid_create("myuser@mydomain");
Jid *result = jid_create("myuser@mydomain");
assert_string_equals("mydomain", result->domainpart);
}