[PATCH:libFS 2/7] Remove unused internal helper _FSGetHostname

Jasper St. Pierre jstpierre at mecheye.net
Tue Jan 7 21:40:48 PST 2014


Patches 2, 3, 4, 5 are:

Reviewed-by: Jasper St. Pierre <jstpierre at mecheye.net>


On Tue, Jan 7, 2014 at 7:02 PM, Alan Coopersmith <
alan.coopersmith at oracle.com> wrote:

> Since we build with -export-symbols-regex '^FS.*', it wasn't available
> to callers outside libFS, and was never called by anything inside libFS.
>
> Xtrans provides it's own exact copy of this function, which gets
> the name _FSTransGetHostname when built in libFS, nothing in libFS
> outside the Xtrans code calls a gethostname() function.
>
> Flagged by cppcheck 1.62:
> [FSlibInt.c:1060]: (style) The function '_FSGetHostname' is never used.
>
> Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
> ---
>  src/FSlibInt.c |   51 ---------------------------------------------------
>  src/FSlibint.h |    1 -
>  2 files changed, 52 deletions(-)
>
> diff --git a/src/FSlibInt.c b/src/FSlibInt.c
> index cb53e44..cd996d1 100644
> --- a/src/FSlibInt.c
> +++ b/src/FSlibInt.c
> @@ -1034,57 +1034,6 @@ _FSFreeQ(void)
>      return;
>  }
>
> -#ifdef _POSIX_SOURCE                     /* stupid makedepend [need if] */
> -#ifndef __QNX__ /* QNX's uname nodename entry is not same as tcpip
> hostname */
> -#define NEED_UTSNAME
> -#endif
> -#endif
> -#ifdef hpux
> -#define NEED_UTSNAME
> -#endif
> -#ifdef SVR4
> -#ifndef _SEQUENT_
> -#define NEED_UTSNAME
> -#endif
> -#endif
> -
> -#ifdef NEED_UTSNAME
> -#include <sys/utsname.h>
> -#endif
> -
> -
> -/*
> - * _FSGetHostname - similar to gethostname but allows special processing.
> - */
> -int
> -_FSGetHostname(
> -    char       *buf,
> -    int                 maxlen)
> -{
> -    int         len;
> -
> -#ifdef NEED_UTSNAME
> -    /*
> -     * same host name crock as in server and xinit.
> -     */
> -    struct utsname name;
> -
> -    uname(&name);
> -    len = strlen(name.nodename);
> -    if (len >= maxlen)
> -       len = maxlen - 1;
> -    strncpy(buf, name.nodename, len);
> -    buf[len] = '\0';
> -#else
> -    buf[0] = '\0';
> -    (void) gethostname(buf, maxlen);
> -    buf[maxlen - 1] = '\0';
> -    len = strlen(buf);
> -#endif                         /* NEED_UTSNAME */
> -
> -    return len;
> -}
> -
>  #ifndef _FSANYSET
>  /*
>   * This is not always a macro.
> diff --git a/src/FSlibint.h b/src/FSlibint.h
> index 60a2ce6..7669778 100644
> --- a/src/FSlibint.h
> +++ b/src/FSlibint.h
> @@ -95,7 +95,6 @@ extern int _FSPrintDefaultError ( FSServer *svr,
> FSErrorEvent *event,
>  extern int _FSDefaultError ( FSServer *svr, FSErrorEvent *event );
>  extern char * _FSAllocScratch ( FSServer *svr, unsigned long nbytes );
>  extern void _FSFreeQ ( void );
> -extern int _FSGetHostname ( char *buf, int maxlen );
>
>  extern FSErrorHandler  FSSetErrorHandler ( FSErrorHandler handler );
>  extern FSIOErrorHandler FSSetIOErrorHandler ( FSIOErrorHandler handler );
> --
> 1.7.9.2
>
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
>



-- 
  Jasper
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.x.org/archives/xorg-devel/attachments/20140108/d3456ae6/attachment-0001.html>


More information about the xorg-devel mailing list