CONTACTS_MATCH_EQUAL,
phonelog_id);
- if (status != CONTACTS_ERROR_NONE) {
- contacts_filter_destroy(filter);
- return 0;
- }
+ if (status != CONTACTS_ERROR_NONE)
+ goto done;
status = contacts_query_create(_contacts_person_phone_log._uri, &query);
- if (status != CONTACTS_ERROR_NONE) {
- contacts_filter_destroy(filter);
- return 0;
- }
+ if (status != CONTACTS_ERROR_NONE)
+ goto done;
status = contacts_query_set_filter(query, filter);
- if (status != CONTACTS_ERROR_NONE) {
- contacts_filter_destroy(filter);
- contacts_query_destroy(query);
- return 0;
- }
+ if (status != CONTACTS_ERROR_NONE)
+ goto done;
status = contacts_db_get_records_with_query(query, -1, -1, &record_list);
- if (status != CONTACTS_ERROR_NONE) {
- contacts_filter_destroy(filter);
- contacts_query_destroy(query);
-
- return 0;
- }
+ if (status != CONTACTS_ERROR_NONE)
+ goto done;
status = contacts_list_first(record_list);
- if (status != CONTACTS_ERROR_NONE) {
- contacts_list_destroy(record_list, TRUE);
- contacts_filter_destroy(filter);
- contacts_query_destroy(query);
-
- return 0;
- }
+ if (status != CONTACTS_ERROR_NONE)
+ goto done;
status = contacts_list_get_current_record_p(record_list, &record);
- if (status != CONTACTS_ERROR_NONE) {
- contacts_list_destroy(record_list, TRUE);
- contacts_filter_destroy(filter);
- contacts_query_destroy(query);
-
- return 0;
- }
+ if (status != CONTACTS_ERROR_NONE)
+ goto done;
status = contacts_record_get_int(record,
_contacts_person_phone_log.person_id,
&person_id);
- if (status != CONTACTS_ERROR_NONE) {
- contacts_list_destroy(record_list, TRUE);
- contacts_filter_destroy(filter);
- contacts_query_destroy(query);
+ if (status != CONTACTS_ERROR_NONE)
+ goto done;
- return 0;
- }
+done:
+ if (record_list != NULL)
+ contacts_list_destroy(record_list, TRUE);
- contacts_list_destroy(record_list, TRUE);
contacts_filter_destroy(filter);
- contacts_query_destroy(query);
+
+ if (query != NULL)
+ contacts_query_destroy(query);
return person_id;
}