import fix-for-SF1869862-searchline.patch
[nedit-bw.git] / dictionary-fix-string-alloc.patch
blobc9a692c6a443199eb863b8c6dfcca42d9fb3208a
1 Subject: remove double allocation in dictionary patch
3 ---
5 source/macro.c | 5 -----
6 1 file changed, 5 deletions(-)
8 diff --quilt old/source/macro.c new/source/macro.c
9 --- old/source/macro.c
10 +++ new/source/macro.c
11 @@ -6109,11 +6109,10 @@ static int dictsaveMS(WindowInfo *window
12 dictionary_filename = strdup(string);
13 dictionary_modified = 1; /* force savedict() to write the actual dictionary */
16 result->tag = STRING_TAG;
17 - AllocNString(&result->val.str, strlen(dictionary_filename)+1);
18 AllocNStringCpy(&result->val.str, dictionary_filename);
20 return True;
21 } else if (nArgs == 2) {
22 if (!readStringArg(argList[0], &string, stringStorage, errMsg)) {
23 @@ -6202,25 +6201,21 @@ static int dictcompleteMS(WindowInfo *wi
25 if (strlen(string) > 0) { /* A string to complete is given */
26 items_left = complete_dict(string, s2, minchars, maxmatches); /* so invoke a new search */
28 if (items_left <= 0) {
29 - AllocNString(&result->val.str, 1);
30 AllocNStringCpy(&result->val.str, "");
31 items_left = 0;
32 } else {
33 items_left--;
34 - AllocNString(&result->val.str, strlen(s2[items_left])+1);
35 AllocNStringCpy(&result->val.str, s2[items_left]);
37 } else { /* An empty key string was given, but maybe there are still some matches left from last call */
38 if (items_left > 0) {
39 items_left--;
40 - AllocNString(&result->val.str, strlen(s2[items_left])+1);
41 AllocNStringCpy(&result->val.str, s2[items_left]);
42 } else {
43 - AllocNString(&result->val.str, 1);
44 AllocNStringCpy(&result->val.str, "");
45 items_left = 0;