texinfo-commits
[Top][All Lists]
Advanced

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

[7668] remove tilde_expansion_failure_hook


From: gavinsmith0123
Subject: [7668] remove tilde_expansion_failure_hook
Date: Sun, 5 Feb 2017 04:29:50 -0500 (EST)

Revision: 7668
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=7668
Author:   gavin
Date:     2017-02-05 04:29:50 -0500 (Sun, 05 Feb 2017)
Log Message:
-----------
remove tilde_expansion_failure_hook

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

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2017-02-04 19:41:28 UTC (rev 7667)
+++ trunk/ChangeLog     2017-02-05 09:29:50 UTC (rev 7668)
@@ -1,5 +1,15 @@
+2017-02-05  Gavin Smith  <address@hidden>
+
+       * info/tilde.c (tilde_expansion_failure_hook): Remove unused 
+       variable.
+       (tilde_expand_word): Do not look at tilde_expansion_failure_hook.
+
 2017-02-04  Gavin Smith  <address@hidden>
 
+       * info/tilde.c [TEST] (main, xmalloc, xrealloc): Remove.
+
+2017-02-04  Gavin Smith  <address@hidden>
+
        * info/echo-area.c (initialize_input_line): Don't consider
        possibility that the prompt argument is null.  This removes the
        appearance that we call 'strlen' on a pointer when it could be 

Modified: trunk/info/tilde.c
===================================================================
--- trunk/info/tilde.c  2017-02-04 19:41:28 UTC (rev 7667)
+++ trunk/info/tilde.c  2017-02-05 09:29:50 UTC (rev 7668)
@@ -35,12 +35,6 @@
 static char *default_suffixes[] =
   { " ", "\n", NULL };
 
-/* If non-null, this contains the address of a function to call if the
-   standard meaning for expanding a tilde fails.  The function is called
-   with the text (sans tilde, as in "foo"), and returns a malloc()'ed string
-   which is the expansion, or a NULL pointer if there is no expansion. */
-CFunction *tilde_expansion_failure_hook = NULL;
-
 /* When non-null, this is a NULL terminated array of strings which
    are duplicates for a tilde prefix.  Bash uses this to expand
    `=~' and `:~'. */
@@ -169,7 +163,7 @@
 }
 
 /* Do the work of tilde expansion on FILENAME.  FILENAME starts with a
-   tilde.  If there is no expansion, call tilde_expansion_failure_hook. */
+   tilde. */
 char *
 tilde_expand_word (const char *filename)
 {
@@ -227,35 +221,14 @@
           username[i - 1] = 0;
 
 #ifndef __MINGW32__
-          if (!(user_entry = (struct passwd *) getpwnam (username)))
+          user_entry = (struct passwd *) getpwnam (username);
+          if (user_entry)
             {
-              /* If the calling program has a special syntax for
-                 expanding tildes, and we couldn't find a standard
-                 expansion, then let them try. */
-              if (tilde_expansion_failure_hook)
-                {
-                  char *expansion = (*tilde_expansion_failure_hook) (username);
-
-                  if (expansion)
-                    {
-                      temp_name = xmalloc (1 + strlen (expansion)
-                                           + strlen (&dirname[i])); 
-                      strcpy (temp_name, expansion);
-                      strcat (temp_name, &dirname[i]);
-                      free (expansion);
-                      goto return_name;
-                    }
-                }
-              /* We shouldn't report errors. */
-            }
-          else
-            {
               temp_name = xmalloc (1 + strlen (user_entry->pw_dir)
                                    + strlen (&dirname[i])); 
               strcpy (temp_name, user_entry->pw_dir);
               strcat (temp_name, &dirname[i]);
 
-            return_name:
               free (dirname);
               dirname = xstrdup (temp_name);
               free (temp_name);
@@ -264,19 +237,6 @@
           endpwent ();
           free (username);
 #else
-         if (tilde_expansion_failure_hook)
-           {
-             char *expansion = (*tilde_expansion_failure_hook) (username);
-
-             if (expansion)
-               {
-                 temp_name = xmalloc (1 + strlen (expansion)
-                                      + strlen (&dirname[i]));
-                 strcpy (temp_name, expansion);
-                 strcat (temp_name, &dirname[i]);
-                 free (expansion);
-               }
-           }
          free (dirname);
          dirname = xstrdup (temp_name);
          free (temp_name);

Modified: trunk/info/tilde.h
===================================================================
--- trunk/info/tilde.h  2017-02-04 19:41:28 UTC (rev 7667)
+++ trunk/info/tilde.h  2017-02-05 09:29:50 UTC (rev 7668)
@@ -1,7 +1,7 @@
 /* tilde.h: tilde expansion.
    $Id$
 
-   Copyright 1988, 1989, 1990, 1991, 1992, 1993, 2004, 2007, 2013
+   Copyright 1988, 1989, 1990, 1991, 1992, 1993, 2004, 2007, 2013, 2017
    Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
@@ -24,12 +24,6 @@
 
 #include "info.h"
 
-/* If non-null, this contains the address of a function to call if the
-   standard meaning for expanding a tilde fails.  The function is called
-   with the text (sans tilde, as in "foo"), and returns a malloc()'ed string
-   which is the expansion, or a NULL pointer if there is no expansion. */
-extern CFunction *tilde_expansion_failure_hook;
-
 /* When non-null, this is a NULL terminated array of strings which
    are duplicates for a tilde prefix.  Bash uses this to expand
    `=~' and `:~'. */
@@ -44,7 +38,7 @@
 extern char *tilde_expand (char *string);
 
 /* Do the work of tilde expansion on FILENAME.  FILENAME starts with a
-   tilde.  If there is no expansion, call tilde_expansion_failure_hook. */
+   tilde. */
 extern char *tilde_expand_word (const char *filename);
 
 #endif /* not TILDE_H */




reply via email to

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