more minor cosmetic fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1995 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
439fbe3e93
commit
6be5339265
16
src/search.c
16
src/search.c
|
@ -31,7 +31,6 @@
|
||||||
#include "proto.h"
|
#include "proto.h"
|
||||||
#include "nano.h"
|
#include "nano.h"
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_REGEX_H
|
#ifdef HAVE_REGEX_H
|
||||||
static int regexp_compiled = FALSE;
|
static int regexp_compiled = FALSE;
|
||||||
|
|
||||||
|
@ -102,14 +101,10 @@ void search_abort(void)
|
||||||
|
|
||||||
void search_init_globals(void)
|
void search_init_globals(void)
|
||||||
{
|
{
|
||||||
if (last_search == NULL) {
|
if (last_search == NULL)
|
||||||
last_search = charalloc(1);
|
last_search = mallocstrcpy(NULL, "");
|
||||||
last_search[0] = '\0';
|
if (last_replace == NULL)
|
||||||
}
|
last_replace = mallocstrcpy(NULL, "");
|
||||||
if (last_replace == NULL) {
|
|
||||||
last_replace = charalloc(1);
|
|
||||||
last_replace[0] = '\0';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set up the system variables for a search or replace. If use_answer
|
/* Set up the system variables for a search or replace. If use_answer
|
||||||
|
@ -533,7 +528,8 @@ int replace_regexp(char *string, bool create_flag)
|
||||||
while (*c != '\0') {
|
while (*c != '\0') {
|
||||||
int num = (int)(*(c + 1) - '0');
|
int num = (int)(*(c + 1) - '0');
|
||||||
|
|
||||||
if (*c != '\\' || num < 1 || num > 9 || num > search_regexp.re_nsub) {
|
if (*c != '\\' || num < 1 || num > 9 || num >
|
||||||
|
search_regexp.re_nsub) {
|
||||||
if (create_flag)
|
if (create_flag)
|
||||||
*string++ = *c;
|
*string++ = *c;
|
||||||
c++;
|
c++;
|
||||||
|
|
|
@ -45,7 +45,7 @@ int regexec_safe(const regex_t *preg, const char *string, size_t nmatch,
|
||||||
#endif /* BROKEN_REGEXEC */
|
#endif /* BROKEN_REGEXEC */
|
||||||
|
|
||||||
/* Assume that string will be found by regexec() if the REG_NOTBOL and
|
/* Assume that string will be found by regexec() if the REG_NOTBOL and
|
||||||
* REG_NOTEOL glags are not set. */
|
* REG_NOTEOL flags are not set. */
|
||||||
int regexp_bol_or_eol(const regex_t *preg, const char *string)
|
int regexp_bol_or_eol(const regex_t *preg, const char *string)
|
||||||
{
|
{
|
||||||
return (regexec(preg, string, 0, NULL, REG_NOTBOL | REG_NOTEOL) ==
|
return (regexec(preg, string, 0, NULL, REG_NOTBOL | REG_NOTEOL) ==
|
||||||
|
|
Loading…
Reference in New Issue