From: Richard Russon Date: Mon, 23 Oct 2017 13:46:09 +0000 (+0100) Subject: rename static functions X-Git-Tag: neomutt-20171208~71^2~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fd8a0871940466f536a67176580786a395adb19c;p=neomutt rename static functions --- diff --git a/imap/browse.c b/imap/browse.c index a80526b33..3615f1913 100644 --- a/imap/browse.c +++ b/imap/browse.c @@ -45,13 +45,13 @@ #include "protos.h" /** - * imap_add_folder - Format and add an IMAP folder to the browser + * add_folder - Format and add an IMAP folder to the browser * * The folder parameter should already be 'unmunged' via * imap_unmunge_mbox_name(). */ -static void imap_add_folder(char delim, char *folder, int noselect, int noinferiors, - struct BrowserState *state, short isparent) +static void add_folder(char delim, char *folder, int noselect, int noinferiors, + struct BrowserState *state, short isparent) { char tmp[LONG_STRING]; char relpath[LONG_STRING]; @@ -156,8 +156,7 @@ static int browse_add_list_result(struct ImapData *idata, const char *cmd, list.noselect = true; /* prune current folder from output */ if (isparent || (mutt_strncmp(list.name, mx.mbox, strlen(list.name)) != 0)) - imap_add_folder(list.delim, list.name, list.noselect, list.noinferiors, - state, isparent); + add_folder(list.delim, list.name, list.noselect, list.noinferiors, state, isparent); } } while (rc == IMAP_CMD_CONTINUE); idata->cmddata = NULL; @@ -268,7 +267,7 @@ int imap_browse(char *path, struct BrowserState *state) if (showparents) { mutt_debug(3, "imap_init_browse: adding parent %s\n", mbox); - imap_add_folder(list.delim, mbox, 1, 0, state, 1); + add_folder(list.delim, mbox, 1, 0, state, 1); } /* if our target isn't a folder, we are in our superior */ @@ -290,7 +289,7 @@ int imap_browse(char *path, struct BrowserState *state) /* folder may be "/" */ snprintf(relpath, sizeof(relpath), "%c", n < 0 ? '\0' : idata->delim); if (showparents) - imap_add_folder(idata->delim, relpath, 1, 0, state, 1); + add_folder(idata->delim, relpath, 1, 0, state, 1); if (!state->folder) { imap_qualify_path(buf, sizeof(buf), &mx, relpath); diff --git a/imap/imap.c b/imap/imap.c index 1b037886a..59241fb3e 100644 --- a/imap/imap.c +++ b/imap/imap.c @@ -65,13 +65,13 @@ #endif /** - * imap_check_capabilities - Make sure we can log in to this server + * check_capabilities - Make sure we can log in to this server */ -static int imap_check_capabilities(struct ImapData *idata) +static int check_capabilities(struct ImapData *idata) { if (imap_exec(idata, "CAPABILITY", 0) != 0) { - imap_error("imap_check_capabilities", idata->buf); + imap_error("check_capabilities", idata->buf); return -1; } @@ -89,11 +89,11 @@ static int imap_check_capabilities(struct ImapData *idata) } /** - * imap_get_flags - Make a simple list out of a FLAGS response + * get_flags - Make a simple list out of a FLAGS response * * return stream following FLAGS response */ -static char *imap_get_flags(struct ListHead *hflags, char *s) +static char *get_flags(struct ListHead *hflags, char *s) { char *flag_word = NULL; char ctmp; @@ -101,14 +101,14 @@ static char *imap_get_flags(struct ListHead *hflags, char *s) /* sanity-check string */ if (mutt_strncasecmp("FLAGS", s, 5) != 0) { - mutt_debug(1, "imap_get_flags: not a FLAGS response: %s\n", s); + mutt_debug(1, "get_flags: not a FLAGS response: %s\n", s); return NULL; } s += 5; SKIPWS(s); if (*s != '(') { - mutt_debug(1, "imap_get_flags: bogus FLAGS response: %s\n", s); + mutt_debug(1, "get_flags: bogus FLAGS response: %s\n", s); return NULL; } @@ -130,7 +130,7 @@ static char *imap_get_flags(struct ListHead *hflags, char *s) /* note bad flags response */ if (*s != ')') { - mutt_debug(1, "imap_get_flags: Unterminated FLAGS response: %s\n", s); + mutt_debug(1, "get_flags: Unterminated FLAGS response: %s\n", s); mutt_list_free(hflags); return NULL; @@ -142,12 +142,12 @@ static char *imap_get_flags(struct ListHead *hflags, char *s) } /** - * imap_set_flag - append str to flags if we currently have permission + * set_flag - append str to flags if we currently have permission * * according to aclbit */ -static void imap_set_flag(struct ImapData *idata, int aclbit, int flag, - const char *str, char *flags, size_t flsize) +static void set_flag(struct ImapData *idata, int aclbit, int flag, + const char *str, char *flags, size_t flsize) { if (mutt_bit_isset(idata->ctx->rights, aclbit)) if (flag && imap_has_flag(&idata->flags, str)) @@ -155,13 +155,13 @@ static void imap_set_flag(struct ImapData *idata, int aclbit, int flag, } /** - * imap_make_msg_set - Make a message set + * make_msg_set - Make a message set * * Note: headers must be in SORT_ORDER. See imap_exec_msgset for args. * Pos is an opaque pointer a la strtok. It should be 0 at first call. */ -static int imap_make_msg_set(struct ImapData *idata, struct Buffer *buf, - int flag, bool changed, bool invert, int *pos) +static int make_msg_set(struct ImapData *idata, struct Buffer *buf, int flag, + bool changed, bool invert, int *pos) { struct Header **hdrs = idata->ctx->hdrs; int count = 0; /* number of messages in message set */ @@ -295,15 +295,15 @@ static int sync_helper(struct ImapData *idata, int right, int flag, const char * } /** - * imap_get_mailbox - split path into (idata,mailbox name) + * get_mailbox - split path into (idata,mailbox name) */ -static int imap_get_mailbox(const char *path, struct ImapData **hidata, char *buf, size_t blen) +static int get_mailbox(const char *path, struct ImapData **hidata, char *buf, size_t blen) { struct ImapMbox mx; if (imap_parse_path(path, &mx)) { - mutt_debug(1, "imap_get_mailbox: Error parsing %s\n", path); + mutt_debug(1, "get_mailbox: Error parsing %s\n", path); return -1; } if (!(*hidata = imap_conn_find(&(mx.account), option(OPT_IMAP_PASSIVE) ? MUTT_IMAP_CONN_NONEW : 0)) || @@ -358,14 +358,13 @@ static int do_search(const struct Pattern *search, int allpats) } /** - * imap_compile_search - Convert NeoMutt pattern to IMAP search + * compile_search - Convert NeoMutt pattern to IMAP search * * Convert neomutt Pattern to IMAP SEARCH command containing only elements * that require full-text search (neomutt already has what it needs for most * match types, and does a better job (eg server doesn't support regexes). */ -static int imap_compile_search(struct Context *ctx, const struct Pattern *pat, - struct Buffer *buf) +static int compile_search(struct Context *ctx, const struct Pattern *pat, struct Buffer *buf) { if (!do_search(pat, 0)) return 0; @@ -392,7 +391,7 @@ static int imap_compile_search(struct Context *ctx, const struct Pattern *pat, mutt_buffer_addstr(buf, "OR "); clauses--; - if (imap_compile_search(ctx, clause, buf) < 0) + if (compile_search(ctx, clause, buf) < 0) return -1; if (clauses) @@ -484,12 +483,12 @@ static size_t longest_common_prefix(char *dest, const char *src, size_t start, s } /** - * imap_complete_hosts - Look for completion matches for mailboxes + * complete_hosts - Look for completion matches for mailboxes * * look for IMAP URLs to complete from defined mailboxes. Could be extended to * complete over open connections and account/folder hooks too. */ -static int imap_complete_hosts(char *dest, size_t len) +static int complete_hosts(char *dest, size_t len) { struct Buffy *mailbox = NULL; struct Connection *conn = NULL; @@ -926,7 +925,7 @@ int imap_open_connection(struct ImapData *idata) if (mutt_strncasecmp("* OK", idata->buf, 4) == 0) { if ((mutt_strncasecmp("* OK [CAPABILITY", idata->buf, 16) != 0) && - imap_check_capabilities(idata)) + check_capabilities(idata)) goto bail; #ifdef USE_SSL /* Attempt STARTTLS if available and desired. */ @@ -974,7 +973,7 @@ int imap_open_connection(struct ImapData *idata) else if (mutt_strncasecmp("* PREAUTH", idata->buf, 9) == 0) { idata->state = IMAP_AUTHENTICATED; - if (imap_check_capabilities(idata) != 0) + if (check_capabilities(idata) != 0) goto bail; FREE(&idata->capstr); } @@ -1103,7 +1102,7 @@ int imap_exec_msgset(struct ImapData *idata, const char *pre, const char *post, { cmd->dptr = cmd->data; mutt_buffer_printf(cmd, "%s ", pre); - rc = imap_make_msg_set(idata, cmd, flag, changed, invert, &pos); + rc = make_msg_set(idata, cmd, flag, changed, invert, &pos); if (rc > 0) { mutt_buffer_printf(cmd, " %s", post); @@ -1159,12 +1158,12 @@ int imap_sync_message_for_copy(struct ImapData *idata, struct Header *hdr, flags[0] = '\0'; - imap_set_flag(idata, MUTT_ACL_SEEN, hdr->read, "\\Seen ", flags, sizeof(flags)); - imap_set_flag(idata, MUTT_ACL_WRITE, hdr->old, "Old ", flags, sizeof(flags)); - imap_set_flag(idata, MUTT_ACL_WRITE, hdr->flagged, "\\Flagged ", flags, sizeof(flags)); - imap_set_flag(idata, MUTT_ACL_WRITE, hdr->replied, "\\Answered ", flags, sizeof(flags)); - imap_set_flag(idata, MUTT_ACL_DELETE, HEADER_DATA(hdr)->deleted, "\\Deleted ", - flags, sizeof(flags)); + set_flag(idata, MUTT_ACL_SEEN, hdr->read, "\\Seen ", flags, sizeof(flags)); + set_flag(idata, MUTT_ACL_WRITE, hdr->old, "Old ", flags, sizeof(flags)); + set_flag(idata, MUTT_ACL_WRITE, hdr->flagged, "\\Flagged ", flags, sizeof(flags)); + set_flag(idata, MUTT_ACL_WRITE, hdr->replied, "\\Answered ", flags, sizeof(flags)); + set_flag(idata, MUTT_ACL_DELETE, HEADER_DATA(hdr)->deleted, "\\Deleted ", + flags, sizeof(flags)); if (mutt_bit_isset(idata->ctx->rights, MUTT_ACL_WRITE)) { @@ -1186,12 +1185,12 @@ int imap_sync_message_for_copy(struct ImapData *idata, struct Header *hdr, * explicitly revoke all system flags (if we have permission) */ if (!*flags) { - imap_set_flag(idata, MUTT_ACL_SEEN, 1, "\\Seen ", flags, sizeof(flags)); - imap_set_flag(idata, MUTT_ACL_WRITE, 1, "Old ", flags, sizeof(flags)); - imap_set_flag(idata, MUTT_ACL_WRITE, 1, "\\Flagged ", flags, sizeof(flags)); - imap_set_flag(idata, MUTT_ACL_WRITE, 1, "\\Answered ", flags, sizeof(flags)); - imap_set_flag(idata, MUTT_ACL_DELETE, !HEADER_DATA(hdr)->deleted, - "\\Deleted ", flags, sizeof(flags)); + set_flag(idata, MUTT_ACL_SEEN, 1, "\\Seen ", flags, sizeof(flags)); + set_flag(idata, MUTT_ACL_WRITE, 1, "Old ", flags, sizeof(flags)); + set_flag(idata, MUTT_ACL_WRITE, 1, "\\Flagged ", flags, sizeof(flags)); + set_flag(idata, MUTT_ACL_WRITE, 1, "\\Answered ", flags, sizeof(flags)); + set_flag(idata, MUTT_ACL_DELETE, !HEADER_DATA(hdr)->deleted, "\\Deleted ", + flags, sizeof(flags)); /* erase custom flags */ if (mutt_bit_isset(idata->ctx->rights, MUTT_ACL_WRITE) && HEADER_DATA(hdr)->flags_remote) @@ -1327,7 +1326,7 @@ int imap_buffy_check(int force, int check_stats) if (mailbox->magic != MUTT_IMAP) continue; - if (imap_get_mailbox(mailbox->path, &idata, name, sizeof(name)) < 0) + if (get_mailbox(mailbox->path, &idata, name, sizeof(name)) < 0) { mailbox->new = false; continue; @@ -1411,7 +1410,7 @@ int imap_status(char *path, int queue) char mbox[LONG_STRING]; struct ImapStatus *status = NULL; - if (imap_get_mailbox(path, &idata, buf, sizeof(buf)) < 0) + if (get_mailbox(path, &idata, buf, sizeof(buf)) < 0) return -1; /* We are in the folder we're polling - just return the mailbox count. @@ -1537,7 +1536,7 @@ int imap_search(struct Context *ctx, const struct Pattern *pat) mutt_buffer_init(&buf); mutt_buffer_addstr(&buf, "UID SEARCH "); - if (imap_compile_search(ctx, pat, &buf) < 0) + if (compile_search(ctx, pat, &buf) < 0) { FREE(&buf.data); return -1; @@ -1632,7 +1631,7 @@ int imap_complete(char *dest, size_t dlen, char *path) if (imap_parse_path(path, &mx)) { strfcpy(dest, path, dlen); - return imap_complete_hosts(dest, dlen); + return complete_hosts(dest, dlen); } /* don't open a new socket just for completion. Instead complete over @@ -1642,7 +1641,7 @@ int imap_complete(char *dest, size_t dlen, char *path) { FREE(&mx.mbox); strfcpy(dest, path, dlen); - return imap_complete_hosts(dest, dlen); + return complete_hosts(dest, dlen); } /* reformat path for IMAP list, and append wildcard */ @@ -1918,7 +1917,7 @@ static int imap_open_mailbox(struct Context *ctx) if (STAILQ_EMPTY(&idata->flags)) { mutt_debug(3, "Getting mailbox FLAGS\n"); - pc = imap_get_flags(&idata->flags, pc); + pc = get_flags(&idata->flags, pc); if (!pc) goto fail; } @@ -1931,7 +1930,7 @@ static int imap_open_mailbox(struct Context *ctx) mutt_list_free(&idata->flags); /* skip "OK [PERMANENT" so syntax is the same as FLAGS */ pc += 13; - pc = imap_get_flags(&(idata->flags), pc); + pc = get_flags(&(idata->flags), pc); if (!pc) goto fail; } diff --git a/imap/message.c b/imap/message.c index 486156bdc..5021395e2 100644 --- a/imap/message.c +++ b/imap/message.c @@ -53,13 +53,13 @@ #include "hcache/hcache.h" #endif -static struct ImapHeaderData *imap_new_header_data(void) +static struct ImapHeaderData *new_header_data(void) { struct ImapHeaderData *d = safe_calloc(1, sizeof(struct ImapHeaderData)); return d; } -static void imap_update_context(struct ImapData *idata, int oldmsgcount) +static void update_context(struct ImapData *idata, int oldmsgcount) { struct Context *ctx = NULL; struct Header *h = NULL; @@ -388,7 +388,7 @@ static void flush_buffer(char *buf, size_t *len, struct Connection *conn) *len = 0; } -static void imap_alloc_msn_index(struct ImapData *idata, unsigned int msn_count) +static void alloc_msn_index(struct ImapData *idata, unsigned int msn_count) { unsigned int new_size; @@ -421,7 +421,7 @@ static void imap_alloc_msn_index(struct ImapData *idata, unsigned int msn_count) } /** - * imap_generate_seqset - Generate a sequence set + * generate_seqset - Generate a sequence set * * Generates a more complicated sequence set after using the header cache, * in case there are missing MSNs in the middle. @@ -430,8 +430,8 @@ static void imap_alloc_msn_index(struct ImapData *idata, unsigned int msn_count) * Ideally, we would generate multiple requests if the number of ranges * is too big, but for now just abort to using the whole range. */ -static void imap_generate_seqset(struct Buffer *b, struct ImapData *idata, - unsigned int msn_begin, unsigned int msn_end) +static void generate_seqset(struct Buffer *b, struct ImapData *idata, + unsigned int msn_begin, unsigned int msn_end) { int chunks = 0; int state = 0; /* 1: single msn, 2: range of msn */ @@ -481,9 +481,9 @@ static void imap_generate_seqset(struct Buffer *b, struct ImapData *idata, /* Sets server_changes to 1 if a change to a flag is made, or in the * case of local_changes, if a change to a flag _would_ have been * made. */ -static void imap_set_changed_flag(struct Context *ctx, struct Header *h, - int local_changes, int *server_changes, int flag_name, - int old_hd_flag, int new_hd_flag, int h_flag) +static void set_changed_flag(struct Context *ctx, struct Header *h, + int local_changes, int *server_changes, int flag_name, + int old_hd_flag, int new_hd_flag, int h_flag) { /* If there are local_changes, we only want to note if the server * flags have changed, so we can set a reopen flag in @@ -572,7 +572,7 @@ int imap_read_headers(struct ImapData *idata, unsigned int msn_begin, unsigned i /* make sure context has room to hold the mailbox */ while (msn_end > ctx->hdrmax) mx_alloc_memory(ctx); - imap_alloc_msn_index(idata, msn_end); + alloc_msn_index(idata, msn_end); idx = ctx->msgcount; oldmsgcount = ctx->msgcount; @@ -612,7 +612,7 @@ int imap_read_headers(struct ImapData *idata, unsigned int msn_begin, unsigned i mutt_progress_update(&progress, msgno, -1); memset(&h, 0, sizeof(h)); - h.data = imap_new_header_data(); + h.data = new_header_data(); do { rc = imap_cmd_step(idata); @@ -708,7 +708,7 @@ int imap_read_headers(struct ImapData *idata, unsigned int msn_begin, unsigned i { /* In case there are holes in the header cache. */ evalhc = false; - imap_generate_seqset(b, idata, msn_begin, msn_end); + generate_seqset(b, idata, msn_begin, msn_end); } else mutt_buffer_printf(b, "%u:%u", msn_begin, msn_end); @@ -726,7 +726,7 @@ int imap_read_headers(struct ImapData *idata, unsigned int msn_begin, unsigned i rewind(fp); memset(&h, 0, sizeof(h)); - h.data = imap_new_header_data(); + h.data = new_header_data(); /* this DO loop does two things: * 1. handles untagged messages, so we can try again on the same msg @@ -835,7 +835,7 @@ int imap_read_headers(struct ImapData *idata, unsigned int msn_begin, unsigned i msn_end = idata->new_mail_count; while (msn_end > ctx->hdrmax) mx_alloc_memory(ctx); - imap_alloc_msn_index(idata, msn_end); + alloc_msn_index(idata, msn_end); idata->reopen &= ~IMAP_NEWMAIL_PENDING; idata->new_mail_count = 0; } @@ -866,7 +866,7 @@ int imap_read_headers(struct ImapData *idata, unsigned int msn_begin, unsigned i * yet again. */ mx_alloc_memory(ctx); mx_update_context(ctx, ctx->msgcount - oldmsgcount); - imap_update_context(idata, oldmsgcount); + update_context(idata, oldmsgcount); } idata->reopen |= IMAP_REOPEN_ALLOW; @@ -1508,16 +1508,16 @@ char *imap_set_flags(struct ImapData *idata, struct Header *h, char *s, int *ser /* This is redundant with the following two checks. Removing: * mutt_set_flag (ctx, h, MUTT_NEW, !(hd->read || hd->old)); */ - imap_set_changed_flag(ctx, h, local_changes, server_changes, MUTT_OLD, - old_hd.old, hd->old, h->old); - imap_set_changed_flag(ctx, h, local_changes, server_changes, MUTT_READ, - old_hd.read, hd->read, h->read); - imap_set_changed_flag(ctx, h, local_changes, server_changes, MUTT_DELETE, - old_hd.deleted, hd->deleted, h->deleted); - imap_set_changed_flag(ctx, h, local_changes, server_changes, MUTT_FLAG, - old_hd.flagged, hd->flagged, h->flagged); - imap_set_changed_flag(ctx, h, local_changes, server_changes, MUTT_REPLIED, - old_hd.replied, hd->replied, h->replied); + set_changed_flag(ctx, h, local_changes, server_changes, MUTT_OLD, old_hd.old, + hd->old, h->old); + set_changed_flag(ctx, h, local_changes, server_changes, MUTT_READ, + old_hd.read, hd->read, h->read); + set_changed_flag(ctx, h, local_changes, server_changes, MUTT_DELETE, + old_hd.deleted, hd->deleted, h->deleted); + set_changed_flag(ctx, h, local_changes, server_changes, MUTT_FLAG, + old_hd.flagged, hd->flagged, h->flagged); + set_changed_flag(ctx, h, local_changes, server_changes, MUTT_REPLIED, + old_hd.replied, hd->replied, h->replied); /* this message is now definitively *not* changed (mutt_set_flag * marks things changed as a side-effect) */