[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[7697] remove copy_binding
From: |
gavinsmith0123 |
Subject: |
[7697] remove copy_binding |
Date: |
Tue, 21 Mar 2017 10:15:24 -0400 (EDT) |
Revision: 7697
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=7697
Author: gavin
Date: 2017-03-21 10:15:24 -0400 (Tue, 21 Mar 2017)
Log Message:
-----------
remove copy_binding
Modified Paths:
--------------
trunk/ChangeLog
trunk/info/nodes.c
trunk/info/search.c
trunk/info/search.h
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2017-03-21 14:00:55 UTC (rev 7696)
+++ trunk/ChangeLog 2017-03-21 14:15:24 UTC (rev 7697)
@@ -1,5 +1,12 @@
2017-03-21 Gavin Smith <address@hidden>
+ * info/search.c (copy_binding): Remove this function, which is
+ not used much. Remove comment before this function.
+ * info/nodes.c (get_nodes_of_tags_table): Use struct assignment
+ to a local struct instead of copy_binding.
+
+2017-03-21 Gavin Smith <address@hidden>
+
Access list of search matches through accessor functions only.
* info/window.h (MATCH_STATE): New struct type.
Modified: trunk/info/nodes.c
===================================================================
--- trunk/info/nodes.c 2017-03-21 14:00:55 UTC (rev 7696)
+++ trunk/info/nodes.c 2017-03-21 14:15:24 UTC (rev 7697)
@@ -240,11 +240,12 @@
SEARCH_BINDING *buffer_binding)
{
int name_offset;
- SEARCH_BINDING *tmp_search;
+ SEARCH_BINDING s;
long position;
size_t tags_index = 0;
- tmp_search = copy_binding (buffer_binding);
+ /* Copy buffer_binding */
+ s = *buffer_binding;
/* Find the start of the tags table. */
position = buffer_binding->start;
@@ -254,14 +255,13 @@
return;
/* Move to one character before the start of the actual table. */
- tmp_search->start = position;
- tmp_search->start += skip_node_separator
- (tmp_search->buffer + tmp_search->start);
- tmp_search->start += strlen (TAGS_TABLE_BEG_LABEL);
+ s.start = position;
+ s.start += skip_node_separator (s.buffer + s.start);
+ s.start += strlen (TAGS_TABLE_BEG_LABEL);
/* 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 (search_forward ("\n", tmp_search, &position) == search_success)
+ while (search_forward ("\n", &s, &position) == search_success)
{
TAG *entry;
char *nodedef;
@@ -269,22 +269,20 @@
int anchor = 0;
/* Prepare to skip this line. */
- tmp_search->start = position;
- tmp_search->start++;
+ s.start = position;
+ s.start++;
/* Skip past informative "(Indirect)" tags table line. */
- if (!tags_index && looking_at (TAGS_TABLE_IS_INDIRECT_LABEL, tmp_search))
+ if (!tags_index && looking_at (TAGS_TABLE_IS_INDIRECT_LABEL, &s))
continue;
/* Find the label preceding the node name. */
- name_offset =
- string_in_line (INFO_NODE_LABEL, tmp_search->buffer +
tmp_search->start);
+ name_offset = string_in_line (INFO_NODE_LABEL, s.buffer + s.start);
/* If no node label, maybe it's an anchor. */
if (name_offset == -1)
{
- name_offset = string_in_line (INFO_REF_LABEL,
- tmp_search->buffer + tmp_search->start);
+ name_offset = string_in_line (INFO_REF_LABEL, s.buffer + s.start);
if (name_offset != -1)
anchor = 1;
}
@@ -299,8 +297,8 @@
init_file_buffer_tag (file_buffer, entry);
/* Find the beginning of the node definition. */
- tmp_search->start += name_offset;
- nodedef = tmp_search->buffer + tmp_search->start;
+ s.start += name_offset;
+ nodedef = s.buffer + s.start;
nodedef += skip_whitespace (nodedef);
/* Move past the node's name in this tag to the TAGSEP character. */
@@ -328,7 +326,6 @@
add_pointer_to_array (entry, tags_index, file_buffer->tags,
file_buffer->tags_slots, 100);
}
- free (tmp_search);
}
/* Remember in FILE_BUFFER the nodenames, subfilenames, and offsets within the
Modified: trunk/info/search.c
===================================================================
--- trunk/info/search.c 2017-03-21 14:00:55 UTC (rev 7696)
+++ trunk/info/search.c 2017-03-21 14:15:24 UTC (rev 7697)
@@ -36,20 +36,6 @@
They return a long, which is the offset from the start of the buffer
at which the match was found. An offset of -1 indicates failure. */
-/* Make a copy of BINDING without duplicating the data. */
-SEARCH_BINDING *
-copy_binding (SEARCH_BINDING *binding)
-{
- SEARCH_BINDING *copy;
-
- copy = xmalloc (sizeof (SEARCH_BINDING));
- copy->buffer = binding->buffer;
- copy->start = binding->start;
- copy->end = binding->end;
- copy->flags = binding->flags;
- return copy;
-}
-
/* **************************************************************** */
/* */
Modified: trunk/info/search.h
===================================================================
--- trunk/info/search.h 2017-03-21 14:00:55 UTC (rev 7696)
+++ trunk/info/search.h 2017-03-21 14:15:24 UTC (rev 7697)
@@ -51,7 +51,6 @@
search_invalid
};
-SEARCH_BINDING *copy_binding (SEARCH_BINDING *binding);
enum search_result search_forward (char *string,
SEARCH_BINDING *binding, long *poff);
enum search_result search_backward (char *input_string,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [7697] remove copy_binding,
gavinsmith0123 <=