bug-gnulib
[Top][All Lists]
Advanced

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

[PATCH] isdir: clean up, since at least grep still uses it


From: Jim Meyering
Subject: [PATCH] isdir: clean up, since at least grep still uses it
Date: Sat, 26 Dec 2009 10:57:09 +0100

FYI, grep is using isdir, and merely compiling it with
gcc's -Wmissing-prototypes would provoke this:

    isdir.c:28: error: no previous prototype for 'isdir' 

so I've cleaned up:


>From 8fedd05841d5e693cd8fb5266a7963bc075c45f6 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sat, 26 Dec 2009 09:56:23 +0100
Subject: [PATCH] isdir: clean up, since at least grep still uses it

* lib/isdir.c: Include "isdir.h".
(S_ISDIR): Remove now-unneeded definition.
* modules/isdir (Files): Add lib/isdir.h.
* lib/isdir.h: New file, with declaration.
* m4/isdir.m4: Remove file -- unneeded.
---
 ChangeLog     |    9 +++++++++
 lib/isdir.c   |   13 +++----------
 lib/isdir.h   |    1 +
 m4/isdir.m4   |   11 -----------
 modules/isdir |    2 +-
 5 files changed, 14 insertions(+), 22 deletions(-)
 create mode 100644 lib/isdir.h
 delete mode 100644 m4/isdir.m4

diff --git a/ChangeLog b/ChangeLog
index acdc7c1..088bb3b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2009-12-26  Jim Meyering  <address@hidden>
+
+       isdir: clean up, since at least grep still uses it
+       * lib/isdir.c: Include "isdir.h".
+       (S_ISDIR): Remove now-unneeded definition.
+       * modules/isdir (Files): Add lib/isdir.h.
+       * lib/isdir.h: New file, with declaration.
+       * m4/isdir.m4: Remove file -- unneeded.
+
 2009-12-25  Bruno Haible  <address@hidden>

        selinux-h: Make generated .h files standalone.
diff --git a/lib/isdir.c b/lib/isdir.c
index 0f9aec2..19a3f7d 100644
--- a/lib/isdir.c
+++ b/lib/isdir.c
@@ -1,6 +1,6 @@
 /* isdir.c -- determine whether a directory exists

-   Copyright (C) 1990, 1998, 2006 Free Software Foundation, Inc.
+   Copyright (C) 1990, 1998, 2006, 2009 Free Software Foundation, Inc.

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -17,20 +17,13 @@

 #include <config.h>

+#include "isdir.h"
+
 #include <sys/types.h>
 #include <sys/stat.h>

-#if STAT_MACROS_BROKEN
-# undef S_ISDIR
-#endif
-
-#if !defined S_ISDIR && defined S_IFDIR
-# define S_ISDIR(Mode) (((Mode) & S_IFMT) == S_IFDIR)
-#endif
-
 /* If PATH is an existing directory or symbolic link to a directory,
    return nonzero, else 0.  */
-
 int
 isdir (const char *path)
 {
diff --git a/lib/isdir.h b/lib/isdir.h
new file mode 100644
index 0000000..80116bc
--- /dev/null
+++ b/lib/isdir.h
@@ -0,0 +1 @@
+int isdir (const char *path);
diff --git a/m4/isdir.m4 b/m4/isdir.m4
deleted file mode 100644
index 2624856..0000000
--- a/m4/isdir.m4
+++ /dev/null
@@ -1,11 +0,0 @@
-# isdir.m4 serial 2
-dnl Copyright (C) 2002 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-AC_DEFUN([gl_ISDIR],
-[
-  dnl Prerequisites of lib/isdir.c.
-  AC_REQUIRE([AC_HEADER_STAT])
-])
diff --git a/modules/isdir b/modules/isdir
index 001546e..83193e1 100644
--- a/modules/isdir
+++ b/modules/isdir
@@ -3,7 +3,7 @@ Determine whether a directory exists.

 Files:
 lib/isdir.c
-m4/isdir.m4
+lib/isdir.h

 Depends-on:
 stat
-- 
1.6.6.287.gff4d1




reply via email to

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