diff -u nano-hist/proto.h nano-hist-patch/proto.h --- nano-hist/proto.h Mon Oct 21 16:13:46 2002 +++ nano-hist-patch/proto.h Mon Oct 21 17:53:26 2002 @@ -360,9 +360,8 @@ void history_init(void); historytype *find_node(historytype *h, char *s); void remove_node(historytype *r); -void insert_node(historytype *h, char *s); +void insert_node(historytype *h, const char *s); void update_history(historyheadtype *h, char *s); -char *get_history_older(historyheadtype *h); #endif /* Public functions in utils.c */ diff -u nano-hist/search.c nano-hist-patch/search.c --- nano-hist/search.c Mon Oct 21 16:13:46 2002 +++ nano-hist-patch/search.c Mon Oct 21 18:56:02 2002 @@ -388,9 +388,6 @@ int i; filestruct *fileptr = current, *didfind; int fileptr_x = current_x; -#ifndef NANAO_SMALL - historytype *p; -#endif wrap_reset(); i = search_init(0); @@ -690,9 +687,6 @@ int i, numreplaced, beginx; filestruct *begin; char *prevanswer = NULL; -#ifndef NANO_SMALL - historytype *p; -#endif if (ISSET(VIEW_MODE)) { print_view_warning(); @@ -947,7 +941,7 @@ /* find first node containing string *s in history list *h */ historytype *find_node(historytype *h, char *s) { - for (h ; h->next ; h = h->next) + for (; h->next ; h = h->next) if (strcmp(s, h->data) == 0) return h; return NULL; @@ -963,7 +957,7 @@ } /* add a history node after node *h */ -void insert_node(historytype *h, char *s) +void insert_node(historytype *h, const char *s) { historytype *a; @@ -972,8 +966,7 @@ a->prev = h; h->next = a; a->next->prev = a; - a->data = charalloc(strlen(s) + 1); - strcpy(a->data, s); + a->data = mallocstrcpy(NULL, s); } /* add a string to history list */ @@ -982,7 +975,8 @@ historytype *p; if (!ISSET(PICO_MODE)) { - if (p = find_node(h->current, s)) { + p = find_node(h->current, s); + if (p) { remove_node(p); /* delete identical older string */ h->count--; } diff -u nano-hist/winio.c nano-hist-patch/winio.c --- nano-hist/winio.c Mon Oct 21 16:13:46 2002 +++ nano-hist-patch/winio.c Mon Oct 21 19:00:38 2002 @@ -331,8 +331,7 @@ /* (history_mode == 1) ? &search_history : &replace_history */ xend = strlen(history); x = xend; - answer = (char *)nrealloc(answer, xend + 1); - strcpy(answer, history); + answer = mallocstrcpy(answer, history); } break; #endif @@ -344,8 +343,7 @@ /* (history_mode == 1) ? &search_history : &replace_history */ xend = strlen(history); x = xend; - answer = (char *)nrealloc(answer, xend + 1); - strcpy(answer, history); + answer = mallocstrcpy(answer, history); } #endif break;