From 0371d64ef7c7b3acfe10962a810b085072968474 Mon Sep 17 00:00:00 2001 From: Richard Russon Date: Sat, 2 Jun 2018 18:12:56 +0100 Subject: [PATCH] minor tidying - rename parameters - change member types - fix doxygen typo - make variable const --- curs_main.c | 2 +- hcache/hcache.c | 18 +++++++++--------- mbox.c | 4 ++-- mutt/charset.c | 2 +- mutt/file.c | 4 ++-- mutt/file.h | 2 +- mutt/mbyte.c | 2 +- mutt/mbyte.h | 2 +- mutt_logging.c | 2 +- protos.h | 2 +- 10 files changed, 20 insertions(+), 20 deletions(-) diff --git a/curs_main.c b/curs_main.c index fced31ee3..6610c100a 100644 --- a/curs_main.c +++ b/curs_main.c @@ -614,7 +614,7 @@ int index_color(int index_no) * Where regexes overlap, the one nearest the start will be used. * If two regexes start at the same place, the longer match will be used. */ -void mutt_draw_statusline(int cols, const char *buf, int buflen) +void mutt_draw_statusline(int cols, const char *buf, size_t buflen) { size_t i = 0; size_t offset = 0; diff --git a/hcache/hcache.c b/hcache/hcache.c index 487440728..69a9664b8 100644 --- a/hcache/hcache.c +++ b/hcache/hcache.c @@ -145,35 +145,35 @@ static const struct HcacheOps *hcache_get_backend_ops(const char *backend) /** * lazy_malloc - Allocate some memory - * @param siz Minimum size to allocate + * @param size Minimum size to allocate * @retval ptr Allocated memory * * This block is likely to be lazy_realloc()'d repeatedly. * It starts off with a minimum size of 4KiB. */ -static void *lazy_malloc(size_t siz) +static void *lazy_malloc(size_t size) { - if (siz < 4096) - siz = 4096; + if (size < 4096) + size = 4096; - return mutt_mem_malloc(siz); + return mutt_mem_malloc(size); } /** * lazy_realloc - Reallocate some memory * @param ptr Pointer to resize - * @param siz Minimum size + * @param size Minimum size * * The minimum size is 4KiB to avoid repeated resizing. */ -static void lazy_realloc(void *ptr, size_t siz) +static void lazy_realloc(void *ptr, size_t size) { void **p = (void **) ptr; - if (p != NULL && siz < 4096) + if (p != NULL && size < 4096) return; - mutt_mem_realloc(ptr, siz); + mutt_mem_realloc(ptr, size); } /** diff --git a/mbox.c b/mbox.c index 6d02da494..238a42be5 100644 --- a/mbox.c +++ b/mbox.c @@ -55,7 +55,7 @@ */ struct MUpdate { - short valid; + bool valid; LOFF_T hdr; LOFF_T body; long lines; @@ -1097,7 +1097,7 @@ static int mbox_mbox_sync(struct Context *ctx, int *index_hint) * something fails. */ - old_offset[i - first].valid = 1; + old_offset[i - first].valid = true; old_offset[i - first].hdr = ctx->hdrs[i]->offset; old_offset[i - first].body = ctx->hdrs[i]->content->offset; old_offset[i - first].lines = ctx->hdrs[i]->lines; diff --git a/mutt/charset.c b/mutt/charset.c index 6fb2426b3..20be38342 100644 --- a/mutt/charset.c +++ b/mutt/charset.c @@ -669,7 +669,7 @@ const char *mutt_ch_iconv_lookup(const char *chs) /** * mutt_ch_check - Check whether a string can be converted between encodings - * @param[in] ps String to check + * @param[in] s String to check * @param[in] slen Length of the string to check * @param[in] from Current character set * @param[in] to Target character set diff --git a/mutt/file.c b/mutt/file.c index ae9ef2440..4ee443930 100644 --- a/mutt/file.c +++ b/mutt/file.c @@ -960,11 +960,11 @@ void mutt_file_set_mtime(const char *from, const char *to) * This is just as read() would do on !noatime. * Silently ignored if futimens() isn't supported. */ -void mutt_file_touch_atime(int f) +void mutt_file_touch_atime(int fd) { #ifdef HAVE_FUTIMENS struct timespec times[2] = { { 0, UTIME_NOW }, { 0, UTIME_OMIT } }; - futimens(f, times); + futimens(fd, times); #endif } diff --git a/mutt/file.h b/mutt/file.h index 88d3a1fee..0da6430ab 100644 --- a/mutt/file.h +++ b/mutt/file.h @@ -66,7 +66,7 @@ int mutt_file_sanitize_regex(char *dest, size_t destlen, const char *src void mutt_file_set_mtime(const char *from, const char *to); int mutt_file_symlink(const char *oldpath, const char *newpath); int mutt_file_to_absolute_path(char *path, const char *reference); -void mutt_file_touch_atime(int f); +void mutt_file_touch_atime(int fd); void mutt_file_unlink(const char *s); void mutt_file_unlink_empty(const char *path); int mutt_file_unlock(int fd); diff --git a/mutt/mbyte.c b/mutt/mbyte.c index c12662735..cb7ddf147 100644 --- a/mutt/mbyte.c +++ b/mutt/mbyte.c @@ -80,7 +80,7 @@ int mutt_mb_charlen(const char *s, int *width) * The function saves the first character from each word. Words are delimited * by whitespace, or hyphens (so "Jean-Pierre" becomes "JP"). */ -bool mutt_mb_get_initials(const char *name, char *buf, int buflen) +bool mutt_mb_get_initials(const char *name, char *buf, size_t buflen) { if (!name || !buf) return false; diff --git a/mutt/mbyte.h b/mutt/mbyte.h index ce276f6c8..450de5983 100644 --- a/mutt/mbyte.h +++ b/mutt/mbyte.h @@ -42,7 +42,7 @@ extern bool OptLocales; #endif int mutt_mb_charlen(const char *s, int *width); -bool mutt_mb_get_initials(const char *name, char *buf, int buflen); +bool mutt_mb_get_initials(const char *name, char *buf, size_t buflen); bool mutt_mb_is_lower(const char *s); bool mutt_mb_is_shell_char(wchar_t ch); size_t mutt_mb_mbstowcs(wchar_t **pwbuf, size_t *pwbuflen, size_t i, char *buf); diff --git a/mutt_logging.c b/mutt_logging.c index 94dc83221..d31fa5711 100644 --- a/mutt_logging.c +++ b/mutt_logging.c @@ -180,7 +180,7 @@ int log_disp_curses(time_t stamp, const char *file, int line, ret += snprintf(buf2, len, ": %s (errno = %d)", p, errno); } - bool dupe = (strcmp(buf, ErrorBuf) == 0); + const bool dupe = (strcmp(buf, ErrorBuf) == 0); if (!dupe) { /* Only log unique messages */ diff --git a/protos.h b/protos.h index 5348b04ba..8784ad9fc 100644 --- a/protos.h +++ b/protos.h @@ -153,7 +153,7 @@ void mutt_clear_error(void); void mutt_clear_pager_position(void); void mutt_default_save(char *path, size_t pathlen, struct Header *hdr); void mutt_display_address(struct Envelope *env); -void mutt_draw_statusline(int cols, const char *buf, int buflen); +void mutt_draw_statusline(int cols, const char *buf, size_t buflen); int mutt_edit_content_type (struct Header *h, struct Body *b, FILE *fp); void mutt_edit_file(const char *editor, const char *data); void mutt_edit_headers(const char *editor, const char *body, struct Header *msg, -- 2.40.0