[libpanel/wip/chergert/fix-14: 1/2] macros: add simple macros header
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libpanel/wip/chergert/fix-14: 1/2] macros: add simple macros header
- Date: Tue, 13 Sep 2022 01:23:06 +0000 (UTC)
commit d4a06572098237cf933b19bde3dd65fadce3b0b3
Author: Christian Hergert <chergert redhat com>
Date: Sat Sep 10 18:06:21 2022 -0700
macros: add simple macros header
Just so that we stop doing the broken form of setting string properties.
src/panel-macros.h | 43 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
---
diff --git a/src/panel-macros.h b/src/panel-macros.h
new file mode 100644
index 0000000..267e039
--- /dev/null
+++ b/src/panel-macros.h
@@ -0,0 +1,43 @@
+/* panel-macros.h
+ *
+ * Copyright 2022 Christian Hergert <chergert redhat com>
+ *
+ * This file 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 3 of the License, or (at your option)
+ * any later version.
+ *
+ * This file 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 General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: LGPL-3.0-or-later
+ */
+
+#pragma once
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+static inline gboolean
+panel_set_string (char **dest,
+ const char *str)
+{
+ char *copy;
+
+ if (*dest == str || g_strcmp0 (*dest, str) == 0)
+ return FALSE;
+
+ copy = g_strdup (str);
+ g_free (*dest);
+ *dest = copy;
+
+ return TRUE;
+}
+
+G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]