X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=browser.c;h=03e1db93e5791bfa7a0bf4d4b56b7e72ca830338;hp=5baa3b78c6af4edfea0dd4ae030b010ea3a5f8ac;hb=7f7a0be369840b290248e5b0302beb447fa1b3cd;hpb=b3cb6ed8d36c550a2e589910ce51bbc8352ff57c diff --git a/browser.c b/browser.c index 5baa3b7..03e1db9 100644 --- a/browser.c +++ b/browser.c @@ -12,6 +12,8 @@ #endif #include +#include +#include #include "mutt.h" #include "enter.h" @@ -33,9 +35,6 @@ #endif #include "sidebar.h" -#include "lib/mem.h" -#include "lib/intl.h" -#include "lib/str.h" #include "lib/list.h" #include @@ -429,26 +428,22 @@ static void add_folder (MUTTMENU * m, struct browser_state *state, { if (state->entrylen == state->entrymax) { /* need to allocate more space */ - mem_realloc (&state->entry, - sizeof (struct folder_file) * (state->entrymax += 256)); - memset (&state->entry[state->entrylen], 0, - sizeof (struct folder_file) * 256); + p_realloc(&state->entry, state->entrymax += 256); + p_clear(&state->entry[state->entrylen], 256); if (m) m->data = state->entry; } if (s != NULL) { - (state->entry)[state->entrylen].mode = s->st_mode; + (state->entry)[state->entrylen].mode = s->st_mode; (state->entry)[state->entrylen].mtime = s->st_mtime; - (state->entry)[state->entrylen].size = s->st_size; - - (state->entry)[state->entrylen].st = p_new(struct stat, 1); - memcpy ((state->entry)[state->entrylen].st, s, sizeof (struct stat)); + (state->entry)[state->entrylen].size = s->st_size; + (state->entry)[state->entrylen].st = p_dup(s, 1); } (state->entry)[state->entrylen].new = new; - (state->entry)[state->entrylen].name = str_dup (name); - (state->entry)[state->entrylen].desc = str_dup (name); + (state->entry)[state->entrylen].name = m_strdup(name); + (state->entry)[state->entrylen].desc = m_strdup(name); #ifdef USE_IMAP (state->entry)[state->entrylen].imap = 0; #endif @@ -489,7 +484,7 @@ static int examine_directory (MUTTMENU * menu, struct browser_state *state, continue; nntp_sync_sidebar (data); if (prefix && *prefix && strncmp (prefix, data->group, - str_len (prefix)) != 0) + m_strlen(prefix)) != 0) continue; if (!((regexec (Mask.rx, data->group, 0, NULL, 0) == 0) ^ Mask.not)) continue; @@ -539,7 +534,7 @@ static int examine_directory (MUTTMENU * menu, struct browser_state *state, continue; /* we don't need . */ if (prefix && *prefix - && str_ncmp (prefix, de->d_name, str_len (prefix)) != 0) + && str_ncmp (prefix, de->d_name, m_strlen(prefix)) != 0) continue; if (!((regexec (Mask.rx, de->d_name, 0, NULL, 0) == 0) ^ Mask.not)) continue; @@ -780,7 +775,7 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, } else { #endif - for (i = str_len (f) - 1; i > 0 && f[i] != '/'; i--); + for (i = m_strlen(f) - 1; i > 0 && f[i] != '/'; i--); if (i > 0) { if (f[0] == '/') { if (i > sizeof (LastDir) - 1) @@ -898,7 +893,7 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, strfcpy (OldLastDir, LastDir, sizeof (OldLastDir)); if (str_cmp (state.entry[menu->current].name, "..") == 0) { - if (str_cmp ("..", LastDir + str_len (LastDir) - 2) == 0) + if (str_cmp ("..", LastDir + m_strlen(LastDir) - 2) == 0) strcat (LastDir, "/.."); /* __STRCAT_CHECKED__ */ else { char *p = strrchr (LastDir + 1, '/'); @@ -926,7 +921,7 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, strfcpy (LastDir, state.entry[menu->current].name, sizeof (LastDir)); /* tack on delimiter here */ - n = str_len (LastDir) + 1; + n = m_strlen(LastDir) + 1; /* special case "" needs no delimiter */ url_parse_ciss (&url, state.entry[menu->current].name); @@ -1011,7 +1006,7 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, if (ff.tagged) { mutt_concat_path (full, LastDir, ff.name, sizeof (full)); mutt_expand_path (full, sizeof (full)); - tfiles[j++] = str_dup (full); + tfiles[j++] = m_strdup(full); } } *files = tfiles; @@ -1020,7 +1015,7 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, *numfiles = 1; tfiles = p_new(char *, *numfiles); mutt_expand_path (f, flen); - tfiles[0] = str_dup (f); + tfiles[0] = m_strdup(f); *files = tfiles; } } @@ -1134,7 +1129,7 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, #endif { /* add '/' at the end of the directory name if not already there */ - int len = str_len (LastDir); + int len = m_strlen(LastDir); if (len && LastDir[len - 1] != '/' && sizeof (buf) > len) buf[len] = '/'; @@ -1402,7 +1397,7 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, mutt_FormatString (buffer, sizeof (buffer), NONULL(GroupFormat), newsgroup_format_str, (unsigned long) &folder, M_FORMAT_ARROWCURSOR); - f->desc = str_dup (buffer); */ + f->desc = m_strdup(buffer); */ if (menu->current + 1 < menu->max) menu->current++; menu->redraw = REDRAW_MOTION_RESYNCH; @@ -1500,7 +1495,7 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, mutt_FormatString (buffer, sizeof (buffer), NONULL(GroupFormat), newsgroup_format_str, (unsigned long) &folder, M_FORMAT_ARROWCURSOR); - f->desc = str_dup (buffer); + f->desc = m_strdup(buffer); } */ } if (i == OP_BROWSER_SUBSCRIBE || i == OP_BROWSER_UNSUBSCRIBE) {