texinfo-commits
[Top][All Lists]
Advanced

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

[7670] remove tilde_expand (unused)


From: gavinsmith0123
Subject: [7670] remove tilde_expand (unused)
Date: Sun, 5 Feb 2017 08:00:18 -0500 (EST)

Revision: 7670
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=7670
Author:   gavin
Date:     2017-02-05 08:00:17 -0500 (Sun, 05 Feb 2017)
Log Message:
-----------
remove tilde_expand (unused)

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/info/tilde.c
    trunk/info/tilde.h

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2017-02-05 10:15:19 UTC (rev 7669)
+++ trunk/ChangeLog     2017-02-05 13:00:17 UTC (rev 7670)
@@ -1,5 +1,12 @@
 2017-02-05  Gavin Smith  <address@hidden>
 
+       * info/tilde.c (tilde_expand): Delete function, as it is not 
+       actually called anywhere.
+       (tilde_additional_prefixes, tilde_additional_suffixes)
+       (tilde_find_prefix, tilde_find_suffix): Remove.
+
+2017-02-05  Gavin Smith  <address@hidden>
+
        * info/tilde.c (tilde_additional_prefixes, tilde_additional_suffixes):
        Declare as static arrays, as they are not set anywhere else.
 

Modified: trunk/info/tilde.c
===================================================================
--- trunk/info/tilde.c  2017-02-05 10:15:19 UTC (rev 7669)
+++ trunk/info/tilde.c  2017-02-05 13:00:17 UTC (rev 7670)
@@ -23,135 +23,6 @@
 #include "info.h"
 #include "tilde.h"
 
-/* This is a NULL terminated array of strings which
-   are duplicates for a tilde prefix.  This is set to
-   whitespace preceding a tilde so that simple programs
-   which do not perform any word separation get desired behaviour. */
-static char *tilde_additional_prefixes[] = { " ~", "\t~", NULL };
-
-/* This is a NULL terminated array of strings which match
-   the end of a username, instead of just "/".  This is set to
-   whitespace or newline so that simple programs which do not
-   perform any word separation get desired behaviour. */
-static char *tilde_additional_suffixes[] = { " ", "\n", NULL };
-
-/* Find the start of a tilde expansion in STRING, and return the index of
-   the tilde which starts the expansion.  Place the length of the text
-   which identified this tilde starter in LEN, excluding the tilde itself. */
-static int
-tilde_find_prefix (char *string, int *len)
-{
-  register int i, j, string_len;
-  register char **prefixes = tilde_additional_prefixes;
-
-  string_len = strlen (string);
-  *len = 0;
-
-  if (!*string || *string == '~')
-    return 0;
-
-  if (prefixes)
-    {
-      for (i = 0; i < string_len; i++)
-        {
-          for (j = 0; prefixes[j]; j++)
-            {
-              if (strncmp (string + i, prefixes[j], strlen (prefixes[j])) == 0)
-                {
-                  *len = strlen (prefixes[j]) - 1;
-                  return i + *len;
-                }
-            }
-        }
-    }
-  return string_len;
-}
-
-/* Find the end of a tilde expansion in STRING, and return the index of
-   the character which ends the tilde definition.  */
-static int
-tilde_find_suffix (char *string)
-{
-  register int i, j, string_len;
-  register char **suffixes = tilde_additional_suffixes;
-
-  string_len = strlen (string);
-
-  for (i = 0; i < string_len; i++)
-    {
-      if (IS_SLASH (string[i]) || !string[i])
-        break;
-
-      for (j = 0; suffixes && suffixes[j]; j++)
-        {
-          if (strncmp (string + i, suffixes[j], strlen (suffixes[j])) == 0)
-            return i;
-        }
-    }
-  return i;
-}
-
-/* Return a new string which is the result of tilde expanding STRING. */
-char *
-tilde_expand (char *string)
-{
-  char *result;
-  int result_size, result_index;
-
-  result_size = result_index = 0;
-  result = NULL;
-
-  /* Scan through STRING expanding tildes as we come to them. */
-  while (1)
-    {
-      register int start, end;
-      char *tilde_word, *expansion;
-      int len;
-
-      /* Make START point to the tilde which starts the expansion. */
-      start = tilde_find_prefix (string, &len);
-
-      /* Copy the skipped text into the result. */
-      if ((result_index + start + 1) > result_size)
-        result = xrealloc (result, 1 + (result_size += (start + 20)));
-
-      strncpy (result + result_index, string, start);
-      result_index += start;
-
-      /* Advance STRING to the starting tilde. */
-      string += start;
-
-      /* Make END be the index of one after the last character of the
-         username. */
-      end = tilde_find_suffix (string);
-
-      /* If both START and END are zero, we are all done. */
-      if (!start && !end)
-        break;
-
-      /* Expand the entire tilde word, and copy it into RESULT. */
-      tilde_word = xmalloc (1 + end);
-      strncpy (tilde_word, string, end);
-      tilde_word[end] = '\0';
-      string += end;
-
-      expansion = tilde_expand_word (tilde_word);
-      free (tilde_word);
-
-      len = strlen (expansion);
-      if ((result_index + len + 1) > result_size)
-        result = xrealloc (result, 1 + (result_size += (len + 20)));
-
-      strcpy (result + result_index, expansion);
-      result_index += len;
-      free (expansion);
-    }
-
-  result[result_index] = '\0';
-
-  return result;
-}
-
 /* Do the work of tilde expansion on FILENAME.  FILENAME starts with a
    tilde. */
 char *

Modified: trunk/info/tilde.h
===================================================================
--- trunk/info/tilde.h  2017-02-05 10:15:19 UTC (rev 7669)
+++ trunk/info/tilde.h  2017-02-05 13:00:17 UTC (rev 7670)
@@ -24,9 +24,6 @@
 
 #include "info.h"
 
-/* Return a new string which is the result of tilde expanding STRING. */
-extern char *tilde_expand (char *string);
-
 /* Do the work of tilde expansion on FILENAME.  FILENAME starts with a
    tilde. */
 extern char *tilde_expand_word (const char *filename);




reply via email to

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