mirror of
git://git.sv.gnu.org/nano.git
synced 2025-02-04 07:24:14 +03:00
build: fix compilation with --disable-browser --disable-tabcomp
While doing that, move the affected function to the utils.c file and tweak it a bit. This fixes https://savannah.gnu.org/bugs/?52468.
This commit is contained in:
parent
bacb0f717d
commit
8165b20fc1
13
src/files.c
13
src/files.c
@ -2348,19 +2348,6 @@ int diralphasort(const void *va, const void *vb)
|
||||
* have to use multibyte strcasecmp() instead. */
|
||||
return mbstrcasecmp(a, b);
|
||||
}
|
||||
|
||||
/* Free the memory allocated for array, which should contain len
|
||||
* elements. */
|
||||
void free_chararray(char **array, size_t len)
|
||||
{
|
||||
if (array == NULL)
|
||||
return;
|
||||
|
||||
for (; len > 0; len--)
|
||||
free(array[len - 1]);
|
||||
|
||||
free(array);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_TABCOMP
|
||||
|
@ -315,7 +315,6 @@ void do_savefile(void);
|
||||
char *real_dir_from_tilde(const char *buf);
|
||||
#if defined(ENABLE_TABCOMP) || defined(ENABLE_BROWSER)
|
||||
int diralphasort(const void *va, const void *vb);
|
||||
void free_chararray(char **array, size_t len);
|
||||
#endif
|
||||
#ifdef ENABLE_TABCOMP
|
||||
char *input_tab(char *buf, bool allow_files, size_t *place,
|
||||
@ -591,6 +590,9 @@ void snuggly_fit(char **str);
|
||||
void null_at(char **data, size_t index);
|
||||
void unsunder(char *str, size_t true_len);
|
||||
void sunder(char *str);
|
||||
#if !defined(ENABLE_TINY) || defined(ENABLE_TABCOMP) || defined(ENABLE_BROWSER)
|
||||
void free_chararray(char **array, size_t len);
|
||||
#endif
|
||||
const char *fixbounds(const char *r);
|
||||
#ifdef ENABLE_SPELLER
|
||||
bool is_separate_word(size_t position, size_t length, const char *buf);
|
||||
|
14
src/utils.c
14
src/utils.c
@ -193,6 +193,20 @@ void sunder(char *str)
|
||||
}
|
||||
}
|
||||
|
||||
#if !defined(ENABLE_TINY) || defined(ENABLE_TABCOMP) || defined(ENABLE_BROWSER)
|
||||
/* Free the memory of the given array, which should contain len elements. */
|
||||
void free_chararray(char **array, size_t len)
|
||||
{
|
||||
if (array == NULL)
|
||||
return;
|
||||
|
||||
while (len > 0)
|
||||
free(array[--len]);
|
||||
|
||||
free(array);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Fix the regex if we're on platforms which require an adjustment
|
||||
* from GNU-style to BSD-style word boundaries. */
|
||||
const char *fixbounds(const char *r)
|
||||
|
Loading…
x
Reference in New Issue
Block a user