gboolean gdm_settings_direct_get_string (const char *key, char **value) { GdmSettingsEntry *entry; gboolean ret; gboolean res; char *str; g_return_val_if_fail (key != NULL, FALSE); entry = get_entry_for_key (key); g_assert (entry != NULL); assert_signature (entry, "s"); ret = TRUE; res = get_value (key, &str); if (! res) { /* use the default */ str = g_strdup (gdm_settings_entry_get_default_value (entry)); } if (value != NULL) { *value = g_strdup (str); } g_free (str); return ret; }
gboolean gdm_settings_direct_get_int (const char *key, int *value) { GdmSettingsEntry *entry; gboolean ret; gboolean res; char *str; g_return_val_if_fail (key != NULL, FALSE); entry = get_entry_for_key (key); g_assert (entry != NULL); assert_signature (entry, "i"); ret = FALSE; res = get_value (key, &str); if (! res) { /* use the default */ str = g_strdup (gdm_settings_entry_get_default_value (entry)); } ret = gdm_settings_parse_value_as_integer (str, value); g_free (str); return ret; }
static void assert_appends(const git_signature *committer, const git_oid *oid) { git_repository *repo2; git_reference *lookedup_ref; git_reflog *reflog; const git_reflog_entry *entry; /* Reopen a new instance of the repository */ cl_git_pass(git_repository_open(&repo2, "testrepo.git")); /* Lookup the previously created branch */ cl_git_pass(git_reference_lookup(&lookedup_ref, repo2, new_ref)); /* Read and parse the reflog for this branch */ cl_git_pass(git_reflog_read(&reflog, repo2, new_ref)); cl_assert_equal_i(3, (int)git_reflog_entrycount(reflog)); /* The first one was the creation of the branch */ entry = git_reflog_entry_byindex(reflog, 2); cl_assert(git_oid_streq(&entry->oid_old, GIT_OID_HEX_ZERO) == 0); entry = git_reflog_entry_byindex(reflog, 1); assert_signature(committer, entry->committer); cl_assert(git_oid_cmp(oid, &entry->oid_old) == 0); cl_assert(git_oid_cmp(oid, &entry->oid_cur) == 0); cl_assert(entry->msg == NULL); entry = git_reflog_entry_byindex(reflog, 0); assert_signature(committer, entry->committer); cl_assert(git_oid_cmp(oid, &entry->oid_cur) == 0); cl_assert_equal_s(commit_msg, entry->msg); git_reflog_free(reflog); git_repository_free(repo2); git_reference_free(lookedup_ref); }