Author: cazfi
Date: Sun Nov 27 17:58:52 2016
New Revision: 34643

URL: http://svn.gna.org/viewcvs/freeciv?rev=34643&view=rev
Log:
Moved fc_opendir() to a new fc_dirent module.

See patch #8017

Added:
    trunk/utility/fc_dirent.c
    trunk/utility/fc_dirent.h
Modified:
    trunk/client/gui-gtk-2.0/themes.c
    trunk/client/gui-gtk-3.0/themes.c
    trunk/client/gui-gtk-3.22/themes.c
    trunk/client/gui-sdl2/themes.c
    trunk/utility/Makefile.am
    trunk/utility/shared.c
    trunk/utility/support.c
    trunk/utility/support.h

Modified: trunk/client/gui-gtk-2.0/themes.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-2.0/themes.c?rev=34643&r1=34642&r2=34643&view=diff
==============================================================================
--- trunk/client/gui-gtk-2.0/themes.c   (original)
+++ trunk/client/gui-gtk-2.0/themes.c   Sun Nov 27 17:58:52 2016
@@ -25,9 +25,9 @@
 #include <gtk/gtk.h>
 
 /* utility */
+#include "fc_dirent.h"
 #include "mem.h"
 #include "string_vector.h"
-#include "support.h"
 
 /* client */
 #include "themes_common.h"

Modified: trunk/client/gui-gtk-3.0/themes.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.0/themes.c?rev=34643&r1=34642&r2=34643&view=diff
==============================================================================
--- trunk/client/gui-gtk-3.0/themes.c   (original)
+++ trunk/client/gui-gtk-3.0/themes.c   Sun Nov 27 17:58:52 2016
@@ -25,9 +25,9 @@
 #include <gtk/gtk.h>
 
 /* utility */
+#include "fc_dirent.h"
 #include "mem.h"
 #include "string_vector.h"
-#include "support.h"
 
 /* client */
 #include "themes_common.h"

Modified: trunk/client/gui-gtk-3.22/themes.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.22/themes.c?rev=34643&r1=34642&r2=34643&view=diff
==============================================================================
--- trunk/client/gui-gtk-3.22/themes.c  (original)
+++ trunk/client/gui-gtk-3.22/themes.c  Sun Nov 27 17:58:52 2016
@@ -25,9 +25,9 @@
 #include <gtk/gtk.h>
 
 /* utility */
+#include "fc_dirent.h"
 #include "mem.h"
 #include "string_vector.h"
-#include "support.h"
 
 /* client */
 #include "themes_common.h"

Modified: trunk/client/gui-sdl2/themes.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-sdl2/themes.c?rev=34643&r1=34642&r2=34643&view=diff
==============================================================================
--- trunk/client/gui-sdl2/themes.c      (original)
+++ trunk/client/gui-sdl2/themes.c      Sun Nov 27 17:58:52 2016
@@ -21,6 +21,7 @@
 #include <sys/stat.h>
 
 /* utility */
+#include "fc_dirent.h"
 #include "fcintl.h"
 #include "log.h"
 #include "mem.h"

Modified: trunk/utility/Makefile.am
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/utility/Makefile.am?rev=34643&r1=34642&r2=34643&view=diff
==============================================================================
--- trunk/utility/Makefile.am   (original)
+++ trunk/utility/Makefile.am   Sun Nov 27 17:58:52 2016
@@ -19,6 +19,8 @@
                distribute.h    \
                fc_cmdline.c    \
                fc_cmdline.h    \
+               fc_dirent.c     \
+               fc_dirent.h     \
                fc_utf8.c       \
                fc_utf8.h       \
                fc_prehdrs.h    \

Added: trunk/utility/fc_dirent.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/utility/fc_dirent.c?rev=34643&view=auto
==============================================================================
--- trunk/utility/fc_dirent.c   (added)
+++ trunk/utility/fc_dirent.c   Sun Nov 27 17:58:52 2016
@@ -0,0 +1,37 @@
+/***********************************************************************
+ Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
+   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
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+***********************************************************************/
+
+#ifdef HAVE_CONFIG_H
+#include <fc_config.h>
+#endif
+
+#include "fc_dirent.h"
+
+/******************************************************************
+  Wrapper function for opendir() with filename conversion to local
+  encoding on Windows.
+******************************************************************/
+DIR *fc_opendir(const char *dir_to_open)
+{
+#ifdef FREECIV_MSWINDOWS
+  DIR *result;
+  char *dirname_in_local_encoding =
+    internal_to_local_string_malloc(dir_to_open);
+
+  result = opendir(dirname_in_local_encoding);
+  free(dirname_in_local_encoding);
+  return result;
+#else  /* FREECIV_MSWINDOWS */
+  return opendir(dir_to_open);
+#endif /* FREECIV_MSWINDOWS */
+}

Added: trunk/utility/fc_dirent.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/utility/fc_dirent.h?rev=34643&view=auto
==============================================================================
--- trunk/utility/fc_dirent.h   (added)
+++ trunk/utility/fc_dirent.h   Sun Nov 27 17:58:52 2016
@@ -0,0 +1,33 @@
+/***********************************************************************
+ Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
+   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
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+***********************************************************************/
+
+#ifndef FC__DIRENT_H
+#define FC__DIRENT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <freeciv_config.h>
+
+#ifdef FREECIV_HAVE_DIRENT_H
+#include <dirent.h>
+#endif
+
+DIR *fc_opendir(const char *dir_to_open);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif  /* FC__DIRENT_H */

Modified: trunk/utility/shared.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/utility/shared.c?rev=34643&r1=34642&r2=34643&view=diff
==============================================================================
--- trunk/utility/shared.c      (original)
+++ trunk/utility/shared.c      Sun Nov 27 17:58:52 2016
@@ -55,6 +55,7 @@
 
 /* utility */
 #include "astring.h"
+#include "fc_dirent.h"
 #include "fciconv.h"
 #include "fcintl.h"
 #include "mem.h"

Modified: trunk/utility/support.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/utility/support.c?rev=34643&r1=34642&r2=34643&view=diff
==============================================================================
--- trunk/utility/support.c     (original)
+++ trunk/utility/support.c     Sun Nov 27 17:58:52 2016
@@ -522,25 +522,6 @@
 #endif /* FREECIV_MSWINDOWS */
 }
 #endif /* FREECIV_HAVE_LIBZ */
-
-/******************************************************************
-  Wrapper function for opendir() with filename conversion to local
-  encoding on Windows.
-******************************************************************/
-DIR *fc_opendir(const char *dir_to_open)
-{
-#ifdef FREECIV_MSWINDOWS
-  DIR *result;
-  char *dirname_in_local_encoding =
-    internal_to_local_string_malloc(dir_to_open);
-
-  result = opendir(dirname_in_local_encoding);
-  free(dirname_in_local_encoding);
-  return result;
-#else  /* FREECIV_MSWINDOWS */
-  return opendir(dir_to_open);
-#endif /* FREECIV_MSWINDOWS */
-}
 
 /*****************************************************************
   Wrapper function for remove() with filename conversion to local

Modified: trunk/utility/support.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/utility/support.h?rev=34643&r1=34642&r2=34643&view=diff
==============================================================================
--- trunk/utility/support.h     (original)
+++ trunk/utility/support.h     Sun Nov 27 17:58:52 2016
@@ -25,10 +25,6 @@
 ***********************************************************************/
 
 #include <freeciv_config.h>
-
-#ifdef FREECIV_HAVE_DIRENT_H
-#include <dirent.h>
-#endif
 
 #include <stdarg.h>
 #include <stdio.h>
@@ -128,7 +124,6 @@
 #include <zlib.h>
 gzFile fc_gzopen(const char *filename, const char *opentype);
 #endif
-DIR *fc_opendir(const char *dir_to_open);
 int fc_remove(const char *filename);
 int fc_stat(const char *filename, struct stat *buf);
 


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to