[tepl] amtk: add amtk-utils
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tepl] amtk: add amtk-utils
- Date: Fri, 14 Jul 2017 14:01:13 +0000 (UTC)
commit bcf5b011bc1c8a45f090be482d4cfd869206720d
Author: Sébastien Wilmet <swilmet gnome org>
Date: Thu Jul 13 13:22:32 2017 +0200
amtk: add amtk-utils
It now compiles fine.
amtk/Makefile.am | 8 ++++++++
amtk/amtk-utils.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++
amtk/amtk-utils.h | 34 ++++++++++++++++++++++++++++++++++
3 files changed, 89 insertions(+), 0 deletions(-)
---
diff --git a/amtk/Makefile.am b/amtk/Makefile.am
index a1076b1..1ff12d4 100644
--- a/amtk/Makefile.am
+++ b/amtk/Makefile.am
@@ -27,9 +27,17 @@ amtk_public_c_files = \
amtk-menu-item.c \
amtk-menu-shell.c
+amtk_private_headers = \
+ amtk-utils.h
+
+amtk_private_c_files = \
+ amtk-utils.c
+
noinst_LTLIBRARIES = libamtk.la
libamtk_la_SOURCES = \
+ $(amtk_private_c_files) \
+ $(amtk_private_headers) \
$(amtk_public_c_files) \
$(amtk_public_headers)
diff --git a/amtk/amtk-utils.c b/amtk/amtk-utils.c
new file mode 100644
index 0000000..091f981
--- /dev/null
+++ b/amtk/amtk-utils.c
@@ -0,0 +1,47 @@
+/*
+ * This file is part of Amtk - Actions, Menus and Toolbars Kit
+ *
+ * Copyright 2017 - Sébastien Wilmet <swilmet gnome org>
+ *
+ * Amtk is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * Amtk 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 Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "amtk-utils.h"
+
+/* Deep copy of @strv. */
+gchar **
+_amtk_utils_strv_copy (const gchar * const *strv)
+{
+ guint length;
+ gchar **new_strv;
+ guint i;
+
+ if (strv == NULL)
+ {
+ return NULL;
+ }
+
+ length = g_strv_length ((gchar **)strv);
+
+ new_strv = g_malloc ((length + 1) * sizeof (gchar *));
+
+ for (i = 0; i < length; i++)
+ {
+ new_strv[i] = g_strdup (strv[i]);
+ }
+
+ new_strv[length] = NULL;
+
+ return new_strv;
+}
diff --git a/amtk/amtk-utils.h b/amtk/amtk-utils.h
new file mode 100644
index 0000000..7ee743e
--- /dev/null
+++ b/amtk/amtk-utils.h
@@ -0,0 +1,34 @@
+/*
+ * This file is part of Amtk - Actions, Menus and Toolbars Kit
+ *
+ * Copyright 2017 - Sébastien Wilmet <swilmet gnome org>
+ *
+ * Amtk is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * Amtk 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 Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef AMTK_UTILS_H
+#define AMTK_UTILS_H
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+/* String utilities */
+
+G_GNUC_INTERNAL
+gchar ** _amtk_utils_strv_copy (const gchar * const *strv);
+
+G_END_DECLS
+
+#endif /* AMTK_UTILS_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]