summaryrefslogtreecommitdiff
path: root/src/contacts_email.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/contacts_email.c')
-rwxr-xr-xsrc/contacts_email.c54
1 files changed, 20 insertions, 34 deletions
diff --git a/src/contacts_email.c b/src/contacts_email.c
index 8edf26b..143c3ff 100755
--- a/src/contacts_email.c
+++ b/src/contacts_email.c
@@ -32,10 +32,8 @@
int contact_email_create(contact_email_h* email)
{
- if(email == NULL) {
- LOGE("[%s] CONTACTS_ERROR_INVALID_PARAMETER(0x%08x)", __FUNCTION__, CONTACTS_ERROR_INVALID_PARAMETER);
- return CONTACTS_ERROR_INVALID_PARAMETER;
- }
+ CONTACTS_NULL_ARG_CHECK(email);
+
CTSvalue* ret = contacts_svc_value_new(CTS_VALUE_EMAIL);
if(ret == NULL) {
LOGE("[%s] CONTACTS_ERROR_OUT_OF_MEMORY(0x%08x)", __FUNCTION__, CONTACTS_ERROR_OUT_OF_MEMORY);
@@ -48,10 +46,7 @@ int contact_email_create(contact_email_h* email)
int contact_email_destroy(contact_email_h email)
{
- if(email == NULL) {
- LOGE("[%s] CONTACTS_ERROR_INVALID_PARAMETER(0x%08x)", __FUNCTION__, CONTACTS_ERROR_INVALID_PARAMETER);
- return CONTACTS_ERROR_INVALID_PARAMETER;
- }
+ CONTACTS_NULL_ARG_CHECK(email);
if(contacts_svc_value_free((CTSvalue*)email) == CTS_SUCCESS) {
return CONTACTS_ERROR_NONE;
@@ -64,47 +59,39 @@ int contact_email_destroy(contact_email_h email)
int contact_email_get_type(contact_email_h email, contact_email_type_e* type)
{
- if(email == NULL || type == NULL) {
- LOGE("[%s] CONTACTS_ERROR_INVALID_PARAMETER(0x%08x)", __FUNCTION__, CONTACTS_ERROR_INVALID_PARAMETER);
- return CONTACTS_ERROR_INVALID_PARAMETER;
- }
- CTSvalue * CTSemail = (CTSvalue *)email;
- *type = contacts_svc_value_get_int(CTSemail, CTS_EMAIL_VAL_TYPE_INT);
+ CONTACTS_NULL_ARG_CHECK(email);
+ CONTACTS_NULL_ARG_CHECK(type);
+
+ *type = contacts_svc_value_get_int((CTSvalue *)email, CTS_EMAIL_VAL_TYPE_INT);
return CONTACTS_ERROR_NONE;
}
int contact_email_set_type(contact_email_h email, contact_email_type_e type)
{
- if(email == NULL) {
- LOGE("[%s] CONTACTS_ERROR_INVALID_PARAMETER(0x%08x)", __FUNCTION__, CONTACTS_ERROR_INVALID_PARAMETER);
- return CONTACTS_ERROR_INVALID_PARAMETER;
- }
- CTSvalue * CTSemail = (CTSvalue *)email;
- contacts_svc_value_set_int(CTSemail, CTS_NUM_VAL_TYPE_INT, type);
+ CONTACTS_NULL_ARG_CHECK(email);
+
+ contacts_svc_value_set_int((CTSvalue*)email, CTS_EMAIL_VAL_TYPE_INT, type);
return CONTACTS_ERROR_NONE;
}
int contact_email_get_address(contact_email_h email, char** address)
{
- if(email == NULL || address == NULL) {
- LOGE("[%s] CONTACTS_ERROR_INVALID_PARAMETER(0x%08x)", __FUNCTION__, CONTACTS_ERROR_INVALID_PARAMETER);
- return CONTACTS_ERROR_INVALID_PARAMETER;
- }
+ CONTACTS_NULL_ARG_CHECK(email);
+ CONTACTS_NULL_ARG_CHECK(address);
+
*address = NULL;
- CTSvalue * CTSemail = (CTSvalue *)email;
- *address = _contacts_safe_strdup(contacts_svc_value_get_str(CTSemail, CTS_EMAIL_VAL_ADDR_STR));
+ *address = _contacts_safe_strdup(contacts_svc_value_get_str((CTSvalue*)email, CTS_EMAIL_VAL_ADDR_STR));
return CONTACTS_ERROR_NONE;
}
int contact_email_set_address(contact_email_h email, const char* address)
{
- if(email == NULL || address == NULL) {
- LOGE("[%s] CONTACTS_ERROR_INVALID_PARAMETER(0x%08x)", __FUNCTION__, CONTACTS_ERROR_INVALID_PARAMETER);
- return CONTACTS_ERROR_INVALID_PARAMETER;
- }
+ CONTACTS_NULL_ARG_CHECK(email);
+ CONTACTS_NULL_ARG_CHECK(address);
+
CTSvalue * CTSemail = (CTSvalue *)email;
contacts_svc_value_set_str(CTSemail, CTS_EMAIL_VAL_ADDR_STR,address);
@@ -114,10 +101,9 @@ int contact_email_set_address(contact_email_h email, const char* address)
int contact_email_iterator_next(contact_email_iterator_h* email_iterator, contact_email_h* email)
{
- if(email_iterator == NULL || email == NULL) {
- LOGE("[%s] CONTACTS_ERROR_INVALID_PARAMETER(0x%08x)", __FUNCTION__, CONTACTS_ERROR_INVALID_PARAMETER);
- return CONTACTS_ERROR_INVALID_PARAMETER;
- }
+ CONTACTS_NULL_ARG_CHECK(email_iterator);
+ CONTACTS_NULL_ARG_CHECK(email);
+
*email = NULL;
GSList* gslist = (GSList*)*email_iterator;
gslist = _contacts_gslist_next_until_not_deleted(gslist);