Cleanup: gchar as gchar instead of char

Use gchar instead of char in most of the cases where gchar is intended.

Reason: improve compatibility and stability. Issue #1819

Minor refactoring.
This commit is contained in:
John Hernandez
2023-04-19 02:44:19 +02:00
parent faccf24c75
commit 7f3fca2bd0
26 changed files with 138 additions and 269 deletions

View File

@@ -121,26 +121,17 @@ tlscerts_list(void)
for (int i = 0; i < g_strv_length(groups); i++) {
char* fingerprint = strdup(groups[i]);
int version = g_key_file_get_integer(tlscerts, fingerprint, "version", NULL);
char* serialnumber = g_key_file_get_string(tlscerts, fingerprint, "serialnumber", NULL);
char* subjectname = g_key_file_get_string(tlscerts, fingerprint, "subjectname", NULL);
char* issuername = g_key_file_get_string(tlscerts, fingerprint, "issuername", NULL);
char* notbefore = g_key_file_get_string(tlscerts, fingerprint, "start", NULL);
char* notafter = g_key_file_get_string(tlscerts, fingerprint, "end", NULL);
char* keyalg = g_key_file_get_string(tlscerts, fingerprint, "keyalg", NULL);
char* signaturealg = g_key_file_get_string(tlscerts, fingerprint, "signaturealg", NULL);
auto_gchar gchar* serialnumber = g_key_file_get_string(tlscerts, fingerprint, "serialnumber", NULL);
auto_gchar gchar* subjectname = g_key_file_get_string(tlscerts, fingerprint, "subjectname", NULL);
auto_gchar gchar* issuername = g_key_file_get_string(tlscerts, fingerprint, "issuername", NULL);
auto_gchar gchar* notbefore = g_key_file_get_string(tlscerts, fingerprint, "start", NULL);
auto_gchar gchar* notafter = g_key_file_get_string(tlscerts, fingerprint, "end", NULL);
auto_gchar gchar* keyalg = g_key_file_get_string(tlscerts, fingerprint, "keyalg", NULL);
auto_gchar gchar* signaturealg = g_key_file_get_string(tlscerts, fingerprint, "signaturealg", NULL);
TLSCertificate* cert = tlscerts_new(fingerprint, version, serialnumber, subjectname, issuername, notbefore,
notafter, keyalg, signaturealg, NULL);
free(fingerprint);
free(serialnumber);
free(subjectname);
free(issuername);
free(notbefore);
free(notafter);
free(keyalg);
free(signaturealg);
res = g_list_append(res, cert);
}
@@ -316,25 +307,16 @@ tlscerts_get_trusted(const char* const fingerprint)
}
int version = g_key_file_get_integer(tlscerts, fingerprint, "version", NULL);
char* serialnumber = g_key_file_get_string(tlscerts, fingerprint, "serialnumber", NULL);
char* subjectname = g_key_file_get_string(tlscerts, fingerprint, "subjectname", NULL);
char* issuername = g_key_file_get_string(tlscerts, fingerprint, "issuername", NULL);
char* notbefore = g_key_file_get_string(tlscerts, fingerprint, "start", NULL);
char* notafter = g_key_file_get_string(tlscerts, fingerprint, "end", NULL);
char* keyalg = g_key_file_get_string(tlscerts, fingerprint, "keyalg", NULL);
char* signaturealg = g_key_file_get_string(tlscerts, fingerprint, "signaturealg", NULL);
auto_gchar gchar* serialnumber = g_key_file_get_string(tlscerts, fingerprint, "serialnumber", NULL);
auto_gchar gchar* subjectname = g_key_file_get_string(tlscerts, fingerprint, "subjectname", NULL);
auto_gchar gchar* issuername = g_key_file_get_string(tlscerts, fingerprint, "issuername", NULL);
auto_gchar gchar* notbefore = g_key_file_get_string(tlscerts, fingerprint, "start", NULL);
auto_gchar gchar* notafter = g_key_file_get_string(tlscerts, fingerprint, "end", NULL);
auto_gchar gchar* keyalg = g_key_file_get_string(tlscerts, fingerprint, "keyalg", NULL);
auto_gchar gchar* signaturealg = g_key_file_get_string(tlscerts, fingerprint, "signaturealg", NULL);
TLSCertificate* cert = tlscerts_new(fingerprint, version, serialnumber, subjectname, issuername, notbefore,
notafter, keyalg, signaturealg, NULL);
free(serialnumber);
free(subjectname);
free(issuername);
free(notbefore);
free(notafter);
free(keyalg);
free(signaturealg);
return cert;
}