util: run uncrustify

This is the result of running

     $ uncrustify --replace --config ../devel/uncrustify.cfg *.c *.h

in the util directory
This commit is contained in:
uncrustify 2019-06-13 07:33:13 -03:00 committed by David Bremner
parent 33382c2b5b
commit 1a8916786f
13 changed files with 81 additions and 63 deletions

View file

@ -24,7 +24,8 @@
#define ARRAY_SIZE(arr) (sizeof (arr) / sizeof (arr[0])) #define ARRAY_SIZE(arr) (sizeof (arr) / sizeof (arr[0]))
void _notmuch_crypto_cleanup (unused(_notmuch_crypto_t *crypto)) void
_notmuch_crypto_cleanup (unused(_notmuch_crypto_t *crypto))
{ {
} }
@ -37,6 +38,7 @@ _notmuch_crypto_decrypt (bool *attempted,
GError **err) GError **err)
{ {
GMimeObject *ret = NULL; GMimeObject *ret = NULL;
if (decrypt == NOTMUCH_DECRYPT_FALSE) if (decrypt == NOTMUCH_DECRYPT_FALSE)
return NULL; return NULL;
@ -99,6 +101,7 @@ _notmuch_message_crypto_t *
_notmuch_message_crypto_new (void *ctx) _notmuch_message_crypto_new (void *ctx)
{ {
_notmuch_message_crypto_t *ret = talloc_zero (ctx, _notmuch_message_crypto_t); _notmuch_message_crypto_t *ret = talloc_zero (ctx, _notmuch_message_crypto_t);
talloc_set_destructor (ret, _notmuch_message_crypto_destructor); talloc_set_destructor (ret, _notmuch_message_crypto_destructor);
return ret; return ret;
} }

View file

@ -3,7 +3,8 @@
static static
GMimeStream * GMimeStream *
_gzfile_maybe_filter (GMimeStream *file_stream) { _gzfile_maybe_filter (GMimeStream *file_stream)
{
char buf[4]; char buf[4];
int bytes_read; int bytes_read;
@ -84,6 +85,7 @@ static char*
g_string_talloc_strdup (void *ctx, char *g_string) g_string_talloc_strdup (void *ctx, char *g_string)
{ {
char *new_str = talloc_strdup (ctx, g_string); char *new_str = talloc_strdup (ctx, g_string);
g_free (g_string); g_free (g_string);
return new_str; return new_str;
} }
@ -93,6 +95,7 @@ g_mime_certificate_get_valid_userid (GMimeCertificate *cert)
{ {
/* output user id only if validity is FULL or ULTIMATE. */ /* output user id only if validity is FULL or ULTIMATE. */
const char *uid = g_mime_certificate_get_user_id (cert); const char *uid = g_mime_certificate_get_user_id (cert);
if (uid == NULL) if (uid == NULL)
return uid; return uid;
GMimeValidity validity = g_mime_certificate_get_id_validity (cert); GMimeValidity validity = g_mime_certificate_get_id_validity (cert);
@ -102,8 +105,10 @@ g_mime_certificate_get_valid_userid (GMimeCertificate *cert)
} }
const char * const char *
g_mime_certificate_get_fpr16 (GMimeCertificate *cert) { g_mime_certificate_get_fpr16 (GMimeCertificate *cert)
{
const char *fpr = g_mime_certificate_get_fingerprint (cert); const char *fpr = g_mime_certificate_get_fingerprint (cert);
if (! fpr || strlen (fpr) < 16) if (! fpr || strlen (fpr) < 16)
return fpr; return fpr;
@ -114,6 +119,7 @@ char *
g_mime_message_get_address_string (GMimeMessage *message, GMimeAddressType type) g_mime_message_get_address_string (GMimeMessage *message, GMimeAddressType type)
{ {
InternetAddressList *list = g_mime_message_get_addresses (message, type); InternetAddressList *list = g_mime_message_get_addresses (message, type);
return internet_address_list_to_string (list, NULL, 0); return internet_address_list_to_string (list, NULL, 0);
} }
@ -121,6 +127,7 @@ char *
g_mime_message_get_date_string (void *ctx, GMimeMessage *message) g_mime_message_get_date_string (void *ctx, GMimeMessage *message)
{ {
GDateTime *parsed_date = g_mime_message_get_date (message); GDateTime *parsed_date = g_mime_message_get_date (message);
if (parsed_date) { if (parsed_date) {
char *date = g_mime_utils_header_format_date (parsed_date); char *date = g_mime_utils_header_format_date (parsed_date);
return g_string_talloc_strdup (ctx, date); return g_string_talloc_strdup (ctx, date);
@ -145,6 +152,7 @@ char *
g_mime_message_get_reply_to_string (void *ctx, GMimeMessage *message) g_mime_message_get_reply_to_string (void *ctx, GMimeMessage *message)
{ {
InternetAddressList *list = g_mime_message_get_reply_to (message); InternetAddressList *list = g_mime_message_get_reply_to (message);
return g_string_talloc_strdup (ctx, internet_address_list_to_string (list, NULL, 0)); return g_string_talloc_strdup (ctx, internet_address_list_to_string (list, NULL, 0));
} }
@ -161,22 +169,26 @@ g_mime_parser_set_scan_from (GMimeParser *parser, gboolean flag)
*/ */
gboolean gboolean
g_mime_signature_status_good (GMimeSignatureStatus status) { g_mime_signature_status_good (GMimeSignatureStatus status)
{
return ((status & (GMIME_SIGNATURE_STATUS_RED | GMIME_SIGNATURE_STATUS_ERROR_MASK)) == 0); return ((status & (GMIME_SIGNATURE_STATUS_RED | GMIME_SIGNATURE_STATUS_ERROR_MASK)) == 0);
} }
gboolean gboolean
g_mime_signature_status_bad (GMimeSignatureStatus status) { g_mime_signature_status_bad (GMimeSignatureStatus status)
{
return (status & GMIME_SIGNATURE_STATUS_RED); return (status & GMIME_SIGNATURE_STATUS_RED);
} }
gboolean gboolean
g_mime_signature_status_error (GMimeSignatureStatus status) { g_mime_signature_status_error (GMimeSignatureStatus status)
{
return (status & GMIME_SIGNATURE_STATUS_ERROR_MASK); return (status & GMIME_SIGNATURE_STATUS_ERROR_MASK);
} }
gint64 gint64
g_mime_utils_header_decode_date_unix (const char *date) { g_mime_utils_header_decode_date_unix (const char *date)
{
GDateTime *parsed_date = g_mime_utils_header_decode_date (date); GDateTime *parsed_date = g_mime_utils_header_decode_date (date);
time_t ret; time_t ret;

View file

@ -154,6 +154,7 @@ parse_boolean_term (void *ctx, const char *str,
char **prefix_out, char **term_out) char **prefix_out, char **term_out)
{ {
int err = EINVAL; int err = EINVAL;
*prefix_out = *term_out = NULL; *prefix_out = *term_out = NULL;
/* Parse prefix */ /* Parse prefix */
@ -248,6 +249,7 @@ strcase_hash (const void *ptr)
/* This is the djb2 hash. */ /* This is the djb2 hash. */
unsigned int hash = 5381; unsigned int hash = 5381;
while (s && *s) { while (s && *s) {
hash = ((hash << 5) + hash) + tolower (*s); hash = ((hash << 5) + hash) + tolower (*s);
s++; s++;

View file

@ -1,7 +1,7 @@
#include "unicode-util.h" #include "unicode-util.h"
/* Based on Xapian::Unicode::is_wordchar, to avoid forcing clients to /* Based on Xapian::Unicode::is_wordchar, to avoid forcing clients to
link directly to libxapian. * link directly to libxapian.
*/ */
static bool static bool

View file

@ -76,7 +76,8 @@ gz_getline (void *talloc_ctx, char **bufptr, ssize_t *bytes_read, gzFile stream)
return UTIL_SUCCESS; return UTIL_SUCCESS;
} }
const char *gz_error_string (util_status_t status, gzFile file) const char *
gz_error_string (util_status_t status, gzFile file)
{ {
if (status == UTIL_GZERROR) if (status == UTIL_GZERROR)
return gzerror (file, NULL); return gzerror (file, NULL);