texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

texinfo ChangeLog info/dir.c info/info-utils.c ...


From: Sergey Poznyakoff
Subject: texinfo ChangeLog info/dir.c info/info-utils.c ...
Date: Fri, 23 Jan 2009 09:37:41 +0000

CVSROOT:        /cvsroot/texinfo
Module name:    texinfo
Changes by:     Sergey Poznyakoff <gray>        09/01/23 09:37:41

Modified files:
        .              : ChangeLog 
        info           : dir.c info-utils.c man.c nodes.c search.c 
                         search.h session.c 

Log message:
        Fix behavior on invalid regular expressions.
        
        * info/search.h (search_result): New enum.
        (search, regexp_search):
        (search_forward, search_backward): Return enum search_result.
        * info/search.c (search, regexp_search):
        (search_forward, search_backward): Return enum search_result.
        All callers updated.
        * info/session.c (info_search_in_node_internal): Return enum
        search_result. All callers updated.
        (info_search_internal): Stop immediately if the search returns
        search_failure. This happens if the user specified an invalid
        regular expression.
        
        * info/dir.c, info/info-utils.c, info/man.c, info/nodes.c: Update
        uses of search functions.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/ChangeLog?cvsroot=texinfo&r1=1.976&r2=1.977
http://cvs.savannah.gnu.org/viewcvs/texinfo/info/dir.c?cvsroot=texinfo&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/texinfo/info/info-utils.c?cvsroot=texinfo&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/texinfo/info/man.c?cvsroot=texinfo&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/texinfo/info/nodes.c?cvsroot=texinfo&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/texinfo/info/search.c?cvsroot=texinfo&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/texinfo/info/search.h?cvsroot=texinfo&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/texinfo/info/session.c?cvsroot=texinfo&r1=1.45&r2=1.46

Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/texinfo/texinfo/ChangeLog,v
retrieving revision 1.976
retrieving revision 1.977
diff -u -b -r1.976 -r1.977
--- ChangeLog   19 Jan 2009 01:56:12 -0000      1.976
+++ ChangeLog   23 Jan 2009 09:37:40 -0000      1.977
@@ -1,3 +1,22 @@
+2009-01-23  Sergey Poznyakoff  <address@hidden>
+
+       Fix behavior of info on invalid regular expressions.
+       
+       * info/search.h (search_result): New enum.
+       (search, regexp_search):
+       (search_forward, search_backward): Return enum search_result.
+       * info/search.c (search, regexp_search):
+       (search_forward, search_backward): Return enum search_result.
+       All callers updated.
+       * info/session.c (info_search_in_node_internal): Return enum
+       search_result. All callers updated.
+       (info_search_internal): Stop immediately if the search returns
+       search_failure. This happens if the user specified an invalid
+       regular expression.
+       
+       * info/dir.c, info/info-utils.c, info/man.c, info/nodes.c: Update
+       uses of search functions.
+
 2009-01-18  Karl Berry  <address@hidden>
 
         * doc/texinfo.tex (\headitemfont): new macro, synonym for @b.

Index: info/dir.c
===================================================================
RCS file: /cvsroot/texinfo/texinfo/info/dir.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- info/dir.c  11 Jun 2008 09:55:41 -0000      1.8
+++ info/dir.c  23 Jan 2009 09:37:40 -0000      1.9
@@ -1,8 +1,8 @@
 /* dir.c -- how to build a special "dir" node from "localdir" files.
-   $Id: dir.c,v 1.8 2008/06/11 09:55:41 gray Exp $
+   $Id: dir.c,v 1.9 2009/01/23 09:37:40 gray Exp $
 
    Copyright (C) 1993, 1997, 1998, 2004, 2007, 
-   2008 Free Software Foundation, Inc.
+   2008, 2009 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -180,11 +180,9 @@
   fb_binding.flags = S_FoldCase | S_SkipDest;
 
   /* Move to the start of the menus in CONTENTS and FB. */
-  contents_offset = search_forward (INFO_MENU_LABEL, &contents_binding);
-  fb_offset = search_forward (INFO_MENU_LABEL, &fb_binding);
-
+  if (search_forward (INFO_MENU_LABEL, &contents_binding, &contents_offset)
+      != search_success)
   /* If there is no menu in CONTENTS, quit now. */
-  if (contents_offset == -1)
     return;
 
   /* There is a menu in CONTENTS, and contents_offset points to the first
@@ -193,7 +191,8 @@
   contents_offset += skip_whitespace_and_newlines (contents + contents_offset);
 
   /* If there is no menu in FB, make one. */
-  if (fb_offset == -1)
+  if (search_forward (INFO_MENU_LABEL, &fb_binding, &fb_offset)
+      != search_success)
     {
       /* Find the start of the second node in this file buffer.  If there
          is only one node, we will be adding the contents to the end of
@@ -224,8 +223,8 @@
       fb_binding.buffer = fb->contents;
       fb_binding.start = 0;
       fb_binding.end = fb->filesize;
-      fb_offset = search_forward (INFO_MENU_LABEL, &fb_binding);
-      if (fb_offset == -1)
+      if (search_forward (INFO_MENU_LABEL, &fb_binding, &fb_offset)
+         != search_success)
         abort ();
     }
 

Index: info/info-utils.c
===================================================================
RCS file: /cvsroot/texinfo/texinfo/info/info-utils.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- info/info-utils.c   5 Oct 2008 14:56:12 -0000       1.13
+++ info/info-utils.c   23 Jan 2009 09:37:40 -0000      1.14
@@ -1,7 +1,7 @@
 /* info-utils.c -- miscellanous.
-   $Id: info-utils.c,v 1.13 2008/10/05 14:56:12 gray Exp $
+   $Id: info-utils.c,v 1.14 2009/01/23 09:37:40 gray Exp $
 
-   Copyright (C) 1993, 1998, 2003, 2004, 2007, 2008
+   Copyright (C) 1993, 1998, 2003, 2004, 2007, 2008, 2009
    Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
@@ -201,9 +201,8 @@
   tmp_search.flags = S_FoldCase;
 
   /* Find the start of the menu. */
-  position = search_forward (INFO_MENU_LABEL, &tmp_search);
-
-  if (position == -1)
+  if (search_forward (INFO_MENU_LABEL, &tmp_search, &position)
+      != search_success)
     return NULL;
 
   /* We have the start of the menu now.  Glean menu items from the rest
@@ -272,7 +271,7 @@
 
   searching_for_menu_items = (mbscasecmp (label, INFO_MENU_ENTRY_LABEL) == 0);
 
-  while ((position = search_forward (label, &tmp_search)) != -1)
+  while (search_forward (label, &tmp_search, &position) == search_success)
     {
       int offset, start;
       char *refdef;

Index: info/man.c
===================================================================
RCS file: /cvsroot/texinfo/texinfo/info/man.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- info/man.c  28 Jun 2008 08:09:32 -0000      1.14
+++ info/man.c  23 Jan 2009 09:37:40 -0000      1.15
@@ -1,8 +1,8 @@
 /*  man.c: How to read and format man files.
-    $Id: man.c,v 1.14 2008/06/28 08:09:32 gray Exp $
+    $Id: man.c,v 1.15 2009/01/23 09:37:40 gray Exp $
 
    Copyright (C) 1995, 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005, 
-   2007, 2008 Free Software Foundation, Inc.
+   2007, 2008, 2009 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -499,8 +499,8 @@
 
   for (i = 0; reference_section_starters[i] != NULL; i++)
     {
-      position = search_forward (reference_section_starters[i], &frs_binding);
-      if (position != -1)
+      if (search_forward (reference_section_starters[i], &frs_binding,
+                         &position) == search_success)
         break;
     }
 
@@ -544,7 +544,7 @@
      within parenthesis. */
   reference_section->flags = 0;
 
-  while ((position = search_forward ("(", reference_section)) != -1)
+  while (search_forward ("(", reference_section, &position) == search_success)
     {
       register int start, end;
 

Index: info/nodes.c
===================================================================
RCS file: /cvsroot/texinfo/texinfo/info/nodes.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- info/nodes.c        5 Oct 2008 14:56:12 -0000       1.12
+++ info/nodes.c        23 Jan 2009 09:37:40 -0000      1.13
@@ -1,8 +1,8 @@
 /* nodes.c -- how to get an Info file and node.
-   $Id: nodes.c,v 1.12 2008/10/05 14:56:12 gray Exp $
+   $Id: nodes.c,v 1.13 2009/01/23 09:37:40 gray Exp $
 
    Copyright (C) 1993, 1998, 1999, 2000, 2002, 2003, 2004, 2006, 2007,
-   2008 Free Software Foundation, Inc.
+   2008, 2009 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -409,11 +409,10 @@
     binding.end = 0;
   binding.flags = S_FoldCase;
 
-  position = search_backward (TAGS_TABLE_END_LABEL, &binding);
-
+  if (search_backward (TAGS_TABLE_END_LABEL, &binding, &position)
+      == search_success)
   /* If there is a tag table, find the start of it, and grovel over it
      extracting tag information. */
-  if (position != -1)
     while (1)
       {
         long tags_table_begin, tags_table_end;
@@ -436,9 +435,8 @@
         binding.end = 0;
 
         /* Locate the start of the tags table. */
-        position = search_backward (TAGS_TABLE_BEG_LABEL, &binding);
-
-        if (position == -1)
+        if (search_backward (TAGS_TABLE_BEG_LABEL, &binding, &position)
+           != search_success)
           break;
 
         binding.end = position;
@@ -476,9 +474,8 @@
             indirect.buffer = binding.buffer;
             indirect.flags = S_FoldCase;
 
-            position = search_backward (INDIRECT_TAGS_TABLE_LABEL, &indirect);
-
-            if (position == -1)
+            if (search_backward (INDIRECT_TAGS_TABLE_LABEL, &indirect,
+                                &position) != search_success)
               {
                 /* This file is malformed.  Give up. */
                 return;
@@ -622,7 +619,7 @@
 
   /* The tag table consists of lines containing node names and positions.
      Do each line until we find one that doesn't contain a node name. */
-  while ((position = search_forward ("\n", tmp_search)) != -1)
+  while (search_forward ("\n", tmp_search, &position) == search_success)
     {
       TAG *entry;
       char *nodedef;

Index: info/search.c
===================================================================
RCS file: /cvsroot/texinfo/texinfo/info/search.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- info/search.c       11 Jun 2008 09:55:42 -0000      1.9
+++ info/search.c       23 Jan 2009 09:37:40 -0000      1.10
@@ -1,7 +1,7 @@
 /* search.c -- searching large bodies of text.
-   $Id: search.c,v 1.9 2008/06/11 09:55:42 gray Exp $
+   $Id: search.c,v 1.10 2009/01/23 09:37:40 gray Exp $
 
-   Copyright (C) 1993, 1997, 1998, 2002, 2004, 2007, 2008
+   Copyright (C) 1993, 1997, 1998, 2002, 2004, 2007, 2008, 2009
    Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
@@ -70,16 +70,16 @@
 
 /* Search forwards or backwards for the text delimited by BINDING.
    The search is forwards if BINDING->start is greater than BINDING->end. */
-long
-search (char *string, SEARCH_BINDING *binding)
+enum search_result
+search (char *string, SEARCH_BINDING *binding, long *poff)
 {
-  long result;
+  enum search_result result;
 
   /* If the search is backwards, then search backwards, otherwise forwards. */
   if (binding->start > binding->end)
-    result = search_backward (string, binding);
+    result = search_backward (string, binding, poff);
   else
-    result = search_forward (string, binding);
+    result = search_forward (string, binding, poff);
 
   return result;
 }
@@ -88,13 +88,13 @@
    delimited by BINDING. The search is forwards if BINDING->start is greater
    than BINDING->end.
 
-   If PRET is specified, it receives a copy of BINDING at the end of a
+   If PEND is specified, it receives a copy of BINDING at the end of a
    succeded search.  Its START and END fields contain bounds of the found
    string instance. 
 */
-long
+enum search_result
 regexp_search (char *regexp, SEARCH_BINDING *binding, long length,
-              SEARCH_BINDING *pret)
+              long *poff, SEARCH_BINDING *pend)
 {
   static char *previous_regexp = NULL;
   static char *previous_content = NULL;
@@ -164,7 +164,7 @@
           char *buf = xmalloc (size);
           regerror (result, &preg, buf, size);
           info_error (_("regexp error: %s"), buf, NULL);
-          return -1;
+          return search_failure;
         }
 
       previous_regexp = xstrdup(regexp);
@@ -225,14 +225,15 @@
         {
           if (matches[i].rm_so <= pos)
            {
-             if (pret)
+             if (pend)
                {
-                 pret->buffer = binding->buffer;
-                 pret->flags = binding->flags;
-                 pret->start = matches[i].rm_so;
-                 pret->end = matches[i].rm_eo;
+                 pend->buffer = binding->buffer;
+                 pend->flags = binding->flags;
+                 pend->start = matches[i].rm_so;
+                 pend->end = matches[i].rm_eo;
                }
-             return matches[i].rm_so;
+             *poff = matches[i].rm_so;
+             return search_success;
            }
         }
     }
@@ -244,28 +245,29 @@
         {
           if (matches[i].rm_so >= pos)
             {
-             if (pret)
+             if (pend)
                {
-                 pret->buffer = binding->buffer;
-                 pret->flags = binding->flags;
-                 pret->start = matches[i].rm_so;
-                 pret->end = matches[i].rm_eo;
+                 pend->buffer = binding->buffer;
+                 pend->flags = binding->flags;
+                 pend->start = matches[i].rm_so;
+                 pend->end = matches[i].rm_eo;
                }
               if (binding->flags & S_SkipDest)
-                return matches[i].rm_eo;
+                *poff = matches[i].rm_eo;
               else
-                return matches[i].rm_so;
+                *poff = matches[i].rm_so;
+             return search_success;
             }
         }
     }
 
   /* not found */
-  return -1;
+  return search_not_found;
 }
 
 /* Search forwards for STRING through the text delimited in BINDING. */
-long
-search_forward (char *string, SEARCH_BINDING *binding)
+enum search_result
+search_forward (char *string, SEARCH_BINDING *binding, long *poff)
 {
   register int c, i, len;
   register char *buff, *end;
@@ -310,7 +312,8 @@
             free (alternate);
           if (binding->flags & S_SkipDest)
             buff += len;
-          return buff - binding->buffer;
+          *poff = buff - binding->buffer;
+         return search_success;
         }
 
       buff++;
@@ -319,12 +322,12 @@
   if (alternate)
     free (alternate);
 
-  return -1;
+  return search_not_found;
 }
 
 /* Search for STRING backwards through the text delimited in BINDING. */
-long
-search_backward (char *input_string, SEARCH_BINDING *binding)
+enum search_result
+search_backward (char *input_string, SEARCH_BINDING *binding, long *poff)
 {
   register int c, i, len;
   register char *buff, *end;
@@ -379,7 +382,8 @@
 
           if (binding->flags & S_SkipDest)
             buff -= len;
-          return 1 + buff - binding->buffer;
+          *poff = 1 + buff - binding->buffer;
+         return search_success;
         }
 
       buff--;
@@ -389,7 +393,7 @@
   if (alternate)
     free (alternate);
 
-  return -1;
+  return search_not_found;
 }
 
 /* Find STRING in LINE, returning the offset of the end of the string.
@@ -400,6 +404,7 @@
 {
   register int end;
   SEARCH_BINDING binding;
+  long offset;
 
   /* Find the end of the line. */
   for (end = 0; line[end] && line[end] != '\n'; end++);
@@ -410,7 +415,9 @@
   binding.end = end;
   binding.flags = S_FoldCase | S_SkipDest;
 
-  return search_forward (string, &binding);
+  if (search_forward (string, &binding, &offset) == search_success)
+    return offset;
+  return -1;
 }
 
 /* Return non-zero if STRING is the first text to appear at BINDING. */
@@ -419,7 +426,8 @@
 {
   long search_end;
 
-  search_end = search (string, binding);
+  if (search (string, binding, &search_end) != search_success)
+    return 0;
 
   /* If the string was not found, SEARCH_END is -1.  If the string was found,
      but not right away, SEARCH_END is != binding->start.  Otherwise, the

Index: info/search.h
===================================================================
RCS file: /cvsroot/texinfo/texinfo/info/search.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- info/search.h       11 Jun 2008 09:02:11 -0000      1.8
+++ info/search.h       23 Jan 2009 09:37:40 -0000      1.9
@@ -1,7 +1,7 @@
 /* search.h -- Structure used to search large bodies of text, with bounds.
-   $Id: search.h,v 1.8 2008/06/11 09:02:11 gray Exp $
+   $Id: search.h,v 1.9 2009/01/23 09:37:40 gray Exp $
 
-   Copyright (C) 1993, 1997, 1998, 2002, 2004, 2007
+   Copyright (C) 1993, 1997, 1998, 2002, 2004, 2007, 2009
    Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
@@ -42,12 +42,25 @@
 #define S_FoldCase      0x01    /* Set means fold case in searches. */
 #define S_SkipDest      0x02    /* Set means return pointing after the dest. */
 
+enum search_result
+  {
+    search_success,             
+    search_not_found,
+    search_failure
+  };
+
 SEARCH_BINDING *make_binding (char *buffer, long int start, long int end);
 SEARCH_BINDING *copy_binding (SEARCH_BINDING *binding);
-extern long search_forward (char *string, SEARCH_BINDING *binding);
-extern long search_backward (char *input_string, SEARCH_BINDING *binding);
-extern long search (char *string, SEARCH_BINDING *binding);
-extern long regexp_search (char *regexp, SEARCH_BINDING *binding, long length,
+extern enum search_result search_forward (char *string,
+                                         SEARCH_BINDING *binding, long *poff);
+extern enum search_result search_backward (char *input_string,
+                                          SEARCH_BINDING *binding,
+                                          long *poff);
+extern enum search_result search (char *string, SEARCH_BINDING *binding,
+                                 long *poff);
+extern enum search_result regexp_search (char *regexp,
+                                        SEARCH_BINDING *binding, long length,
+                                        long *poff,
                           SEARCH_BINDING *pret);
 extern int looking_at (char *string, SEARCH_BINDING *binding);
 

Index: info/session.c
===================================================================
RCS file: /cvsroot/texinfo/texinfo/info/session.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -b -r1.45 -r1.46
--- info/session.c      9 Oct 2008 12:20:28 -0000       1.45
+++ info/session.c      23 Jan 2009 09:37:40 -0000      1.46
@@ -1,8 +1,8 @@
 /* session.c -- user windowing interface to Info.
-   $Id: session.c,v 1.45 2008/10/09 12:20:28 gray Exp $
+   $Id: session.c,v 1.46 2009/01/23 09:37:40 gray Exp $
 
    Copyright (C) 1993, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
-   2004, 2007, 2008 Free Software Foundation, Inc.
+   2004, 2007, 2008, 2009 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -2671,16 +2671,14 @@
   binding.end = window->node->nodelen;
   binding.flags = S_FoldCase | S_SkipDest;
 
-  position = search (INFO_MENU_LABEL, &binding);
-
-  if (position == -1)
-    info_error (msg_no_menu_node, NULL, NULL);
-  else
+  if (search (INFO_MENU_LABEL, &binding, &position) == search_success)
     {
       window->point = position;
       window_adjust_pagetop (window);
       window->flags |= W_UpdateWindow;
     }
+  else
+    info_error (msg_no_menu_node, NULL, NULL);
 }
 
 /* Visit as many menu items as is possible, each in a separate window. */
@@ -3729,25 +3727,24 @@
   return NULL;
 }
 
-/* Search for STRING in NODE starting at START.  Return -1 if the string
-   was not found, or the location of the string if it was.  If WINDOW is
-   passed as non-null, set the window's node to be NODE, its point to be
-   the found string, and readjust the window's pagetop.  The DIR argument
-   says which direction to search in.  If it is positive, search
-   forward, else backwards.
+/* Search for STRING in NODE starting at START.  If the string was found,
+   return its location in POFF.  If WINDOW is passed as non-null, set the
+   window's node to be NODE, its point to be the found string, and readjust
+   the window's pagetop.  The DIR argument says which direction to search
+   in.  If it is positive, search forward, else backwards.
 
    The last argument, RESBND, makes sense only when USE_REGEX is set.
    If the regexp search succeeds, RESBND is filled with the final state
    of the search binding.  In particular, its START and END fields contain
    bounds of the found string instance.
 */
-static long
+static enum search_result
 info_search_in_node_internal (char *string, NODE *node, long int start,
                              WINDOW *window, int dir, int case_sensitive,
-                             SEARCH_BINDING *resbnd)
+                             long *poff, SEARCH_BINDING *resbnd)
 {
   SEARCH_BINDING binding;
-  long offset;
+  enum search_result result;
 
   binding.buffer = node->contents;
   binding.start = start;
@@ -3769,27 +3766,30 @@
   if (isearch_is_active)
     binding.flags |= S_SkipDest;
 
-  offset = (use_regex ? 
-            regexp_search (string, &binding, node->nodelen, resbnd):
-            search (string, &binding));
-
-  if (offset != -1 && window)
+  result = (use_regex ? 
+           regexp_search (string, &binding, node->nodelen, poff, resbnd):
+           search (string, &binding, poff));
+  if (result == search_success && window)
     {
       set_remembered_pagetop_and_point (window);
       if (window->node != node)
         window_set_node_of_window (window, node);
-      window->point = offset;
+      window->point = *poff;
       window_adjust_pagetop (window);
     }
-  return offset;
+  return result;
 }
 
 long
 info_search_in_node (char *string, NODE *node, long int start,
                     WINDOW *window, int dir, int case_sensitive)
 {
-  return info_search_in_node_internal (string, node, start,
-                                      window, dir, case_sensitive, NULL);
+  long offset;
+  if (info_search_in_node_internal (string, node, start,
+                                   window, dir, case_sensitive,
+                                   &offset, NULL) == search_success)
+    return offset;
+  return -1;
 }
 
 /* Search NODE, looking for the largest possible match of STRING.  Start the
@@ -3845,6 +3845,7 @@
   FILE_BUFFER *file_buffer;
   char *initial_nodename;
   long ret, start;
+  enum search_result result;
 
   file_buffer = file_buffer_of_window (window);
   initial_nodename = window->node->nodename;
@@ -3859,16 +3860,23 @@
        ``finding'' a string that is already under the cursor, anyway.  */
     start = window->point + dir;
   
-  ret = info_search_in_node_internal
+  result = info_search_in_node_internal
         (string, window->node, start, window, dir,
-         case_sensitive, resbnd);
+             case_sensitive, &ret, resbnd);
   
-  if (ret != -1)
+  switch (result)
     {
+    case search_success:
       /* We won! */
       if (!echo_area_is_active && !isearch_is_active)
         window_clear_echo_area ();
       return 0;
+
+    case search_not_found:
+      break;
+      
+    case search_failure:
+      return -1;
     }
   
   start = 0;
@@ -3966,12 +3974,12 @@
           if (dir < 0)
             start = tag->nodelen;
 
-          ret =
+          result =
             info_search_in_node_internal (string, node, start, window, dir,
-                                         case_sensitive, resbnd);
+                                         case_sensitive, &ret, resbnd);
 
           /* Did we find the string in this node? */
-          if (ret != -1)
+          if (result == search_success)
             {
               /* Yes!  We win. */
               remember_window_and_node (window, node);
@@ -3989,7 +3997,8 @@
              our starting point. */
           free (node);
 
-          if (strcmp (initial_nodename, tag->nodename) == 0)
+          if (result == search_failure
+             || strcmp (initial_nodename, tag->nodename) == 0)
             return -1;
         }
     }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]