git: libc - Adopt more linux-friendly basename() and dirname()

Matthew Dillon dillon at crater.dragonflybsd.org
Sat Jan 4 12:55:05 PST 2020


commit 207ba6700e31c36bb4e38d4da221a4f86e466ee9
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Sat Jan 4 12:48:20 2020 -0800

    libc - Adopt more linux-friendly basename() and dirname()
    
    * Essentially take the FreeBSD basename() and dirname() code, changing
      the API to be more linux-friendly.  This reduces work required in dports.
    
    * Adjust numerous cases in our base code that assumed the old prototypes
      and side effects.
    
    * The passed-in string pointers are no longer const and can be modified
      in-place by the functions.  The returned value is no longer sometimes
      dynamically allocated and will instead either return a constant string,
      a portion of the passed in string, or a modified portion of the
      passed-in string.
    
      The API unfortunately has to be declared to return a char * instead of
      a const char *, even though it sometimes returns pointers to constant
      strings.
    
      The API is now thread-safe.
    
    * The API is still a huge historical mess but at least the ports for
      the most part assume the above behavior now due to linux doing the
      same thing.
    
    Reviewed-by: multiple people

Summary of changes:
 contrib/gdb-7/include/libiberty.h |  2 +-
 include/libgen.h                  |  4 +-
 lib/libc/gen/basename.c           | 76 ++++++++++--------------------
 lib/libc/gen/dirname.c            | 97 ++++++++++++++++++---------------------
 lib/libpam/libpam/pam_debug_log.c |  6 ++-
 lib/libutil/pw_util.c             |  2 +-
 sbin/devfsctl/devfsctl.c          |  2 +-
 sbin/hammer/cmd_pfs.c             | 21 +++++++--
 usr.bin/evtranalyze/evtranalyze.c |  9 +++-
 usr.bin/newgrp/newgrp.c           |  4 +-
 usr.bin/shlock/shlock.c           |  5 +-
 usr.sbin/hotplugd/hotplugd.c      |  2 +-
 12 files changed, 107 insertions(+), 123 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/207ba6700e31c36bb4e38d4da221a4f86e466ee9


-- 
DragonFly BSD source repository


More information about the Commits mailing list