[geany/geany-plugins] 09832e: Merge pull request #631 from b4n/commonlib

Frank Lanitz git-noreply at xxxxx
Sun Oct 22 08:44:06 UTC 2017


Branch:      refs/heads/master
Author:      Frank Lanitz <frank at frank.uvena.de>
Committer:   GitHub <noreply at github.com>
Date:        Sun, 22 Oct 2017 08:44:06 UTC
Commit:      09832eb3633ac2d1a322880122ce3bf413bff7b7
             https://github.com/geany/geany-plugins/commit/09832eb3633ac2d1a322880122ce3bf413bff7b7

Log Message:
-----------
Merge pull request #631 from b4n/commonlib

Improve/fix some things related to the utils library


Modified Paths:
--------------
    Makefile.am
    build/utils.m4
    build/workbench.m4
    configure.ac
    utils/src/Makefile.am
    utils/src/filelist.c
    utils/src/filelist.h
    workbench/src/wb_project.c

Modified: Makefile.am
3 lines changed, 3 insertions(+), 0 deletions(-)
===================================================================
@@ -2,7 +2,10 @@ ACLOCAL_AMFLAGS = -I build/cache -I build -I build/bundled -I geanypy/m4 --insta
 AM_DISTCHECK_CONFIGURE_FLAGS = --with-geany-libdir='$${libdir}'
 
 SUBDIRS = po
+
+if ENABLE_UTILSLIB
 SUBDIRS += utils
+endif
 
 if ENABLE_ADDONS
 SUBDIRS += addons


Modified: build/utils.m4
39 lines changed, 27 insertions(+), 12 deletions(-)
===================================================================
@@ -1,19 +1,34 @@
-AC_DEFUN([GP_CHECK_UTILSLIB],
+AC_DEFUN([_GP_UTILSLIB_ARG],
 [
-dnl
-dnl TODO: only build the library if any plugins using it are enabled
-dnl
     AC_ARG_ENABLE([utilslib],
               [AS_HELP_STRING([--enable-utilslib],
                               [Whether to use the utilities library [[default=auto]]])],
               [enable_utilslib=$enableval],
               [enable_utilslib=auto])
-    AS_IF([test "x$enable_utilslib" != "xno"], [
-        enable_utilslib=yes
-        GP_STATUS_FEATURE_ADD([Utility library], [$enable_utilslib])
-        AC_CONFIG_FILES([
-            utils/Makefile
-            utils/src/Makefile
-        ])
-    ])
+])
+
+dnl GP_CHECK_UTILSLIB(PluginName)
+dnl Check for utils library
+AC_DEFUN([GP_CHECK_UTILSLIB],
+[
+    AC_REQUIRE([_GP_UTILSLIB_ARG])
+    AS_IF([test "$m4_tolower(AS_TR_SH(enable_$1))" != no &&
+           test "$enable_utilslib" != yes],
+          [AS_IF([test "$enable_utilslib" = "no"],
+                 [AS_IF([test "$m4_tolower(AS_TR_SH(enable_$1))" = yes],
+                        [AC_MSG_ERROR([Plugin $1 depends on utilslib which is disabled])],
+                        [m4_tolower(AS_TR_SH(enable_$1))=no])],
+                 [enable_utilslib=yes])])
+])
+
+AC_DEFUN([GP_COMMIT_UTILSLIB_STATUS],
+[
+    AS_IF([test "$enable_utilslib" = "yes"],
+          [AC_CONFIG_FILES([
+               utils/Makefile
+               utils/src/Makefile
+           ])],
+          [enable_utilslib=no])
+    AM_CONDITIONAL([ENABLE_UTILSLIB], [test "$enable_utilslib" = "yes"])
+    GP_STATUS_FEATURE_ADD([Utility library], [$enable_utilslib])
 ])


Modified: build/workbench.m4
1 lines changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -1,6 +1,7 @@
 AC_DEFUN([GP_CHECK_WORKBENCH],
 [
     GP_ARG_DISABLE([Workbench], [auto])
+    GP_CHECK_UTILSLIB([Workbench])
     GP_COMMIT_PLUGIN_STATUS([Workbench])
     AC_CONFIG_FILES([
         workbench/Makefile


Modified: configure.ac
3 lines changed, 2 insertions(+), 1 deletions(-)
===================================================================
@@ -27,7 +27,6 @@ GP_CHECK_CPPCHECK
 GP_CHECK_CFLAGS
 GP_CHECK_LDFLAGS
 GP_CHECK_MINGW
-GP_CHECK_UTILSLIB
 
 dnl plugin checks
 GP_CHECK_ADDONS
@@ -75,6 +74,8 @@ GP_CHECK_WEBHELPER
 GP_CHECK_WORKBENCH
 GP_CHECK_XMLSNIPPETS
 
+GP_COMMIT_UTILSLIB_STATUS
+
 AC_CONFIG_FILES([
     Makefile
     po/Makefile.in


Modified: utils/src/Makefile.am
2 lines changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -10,5 +10,5 @@ libgeanypluginutils_la_CPPFLAGS = $(AM_CPPFLAGS) \
 	-DG_LOG_DOMAIN=\"Utils\"
 libgeanypluginutils_la_CFLAGS = $(AM_CFLAGS)
 libgeanypluginutils_la_LIBADD = $(COMMONLIBS)
-libgeanypluginutils_la_LDFLAGS = $(GP_LDFLAGS)
+libgeanypluginutils_la_LDFLAGS = -no-undefined $(GP_LDFLAGS)
 include $(top_srcdir)/build/cppcheck.mk


Modified: utils/src/filelist.c
17 lines changed, 7 insertions(+), 10 deletions(-)
===================================================================
@@ -16,9 +16,6 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
-/*
- * Code for the WB_PROJECT structure.
- */
 #include <glib.h>
 #include <glib/gstdio.h>
 
@@ -38,7 +35,8 @@ typedef struct
 	GSList *ignored_dirs_list;
 	GSList *ignored_file_list;
 	GHashTable *visited_paths;
-}SCAN_DIR_PARAMS;
+}
+ScanDirParams;
 
 
 /** Get precompiled patterns.
@@ -90,7 +88,7 @@ static gboolean filelist_patterns_match(GSList *patterns, const gchar *str)
 
 
 /* Scan directory searchdir. Input and output parameters come from/go to params. */
-static void filelist_scan_directory_int(const gchar *searchdir, SCAN_DIR_PARAMS *params)
+static void filelist_scan_directory_int(const gchar *searchdir, ScanDirParams *params)
 {
 	GDir *dir;
 	gchar *locale_path = utils_get_locale_from_utf8(searchdir);
@@ -133,7 +131,8 @@ static void filelist_scan_directory_int(const gchar *searchdir, SCAN_DIR_PARAMS
 		}
 		else if (g_file_test(locale_filename, G_FILE_TEST_IS_REGULAR))
 		{
-			if (filelist_patterns_match(params->file_patterns, utf8_name) && !filelist_patterns_match(params->ignored_file_list, utf8_name))
+			if (filelist_patterns_match(params->file_patterns, utf8_name) && !
+				filelist_patterns_match(params->ignored_file_list, utf8_name))
 			{
 				params->file_count++;
 				params->filelist = g_slist_prepend(params->filelist, g_strdup(utf8_filename));
@@ -172,12 +171,10 @@ static void filelist_scan_directory_int(const gchar *searchdir, SCAN_DIR_PARAMS
  * @return GSList of matched files
  *
  **/
-GSList *filelist_scan_directory(guint *files, guint *folders, const gchar *searchdir, gchar **file_patterns,
+GSList *gp_filelist_scan_directory(guint *files, guint *folders, const gchar *searchdir, gchar **file_patterns,
 		gchar **ignored_dirs_patterns, gchar **ignored_file_patterns)
 {
-	SCAN_DIR_PARAMS params;
-
-	memset(&params, 0, sizeof(params));
+	ScanDirParams params = { 0 };
 
 	if (!file_patterns || !file_patterns[0])
 	{


Modified: utils/src/filelist.h
12 lines changed, 8 insertions(+), 4 deletions(-)
===================================================================
@@ -16,12 +16,16 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
-#ifndef __UTILS_FILELIST_H__
-#define __UTILS_FILELIST_H__
+#ifndef GP_UTILS_FILELIST_H
+#define GP_UTILS_FILELIST_H
 
 #include <glib.h>
 
-GSList *filelist_scan_directory(guint *files, guint *folders, const gchar *searchdir, gchar **file_patterns,
+G_BEGIN_DECLS
+
+GSList *gp_filelist_scan_directory(guint *files, guint *folders, const gchar *searchdir, gchar **file_patterns,
 		gchar **ignored_dirs_patterns, gchar **ignored_file_patterns);
 
-#endif
+G_END_DECLS
+
+#endif /* GP_UTILS_FILELIST_H */


Modified: workbench/src/wb_project.c
2 lines changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -528,7 +528,7 @@ static guint wb_project_dir_rescan_int(WB_PROJECT *prj, WB_PROJECT_DIR *root)
 	searchdir = get_combined_path(prj->filename, root->base_dir);
 	root->file_count = 0;
 	root->folder_count = 0;
-	lst = filelist_scan_directory(&(root->file_count), &(root->folder_count),
+	lst = gp_filelist_scan_directory(&(root->file_count), &(root->folder_count),
 		searchdir, file_patterns, root->ignored_dirs_patterns, root->ignored_file_patterns);
 	g_free(searchdir);
 



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Plugins-Commits mailing list