[glib] resources: Skip initial underscores in resource section names
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] resources: Skip initial underscores in resource section names
- Date: Tue, 17 Jan 2012 11:34:30 +0000 (UTC)
commit d825828b7b00f67a06ef1b6ba7ddb9c5dd6b0d87
Author: Alexander Larsson <alexl redhat com>
Date: Tue Jan 17 12:32:37 2012 +0100
resources: Skip initial underscores in resource section names
Initial underscores are used in c identifier to make them private,
for instance in Gtk+. However, we don't want to have this in the
resource section name, that just looks ugly.
gio/glib-compile-resources.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/gio/glib-compile-resources.c b/gio/glib-compile-resources.c
index f4a787e..d5d8f75 100644
--- a/gio/glib-compile-resources.c
+++ b/gio/glib-compile-resources.c
@@ -387,6 +387,7 @@ main (int argc, char **argv)
gboolean generate_header = FALSE;
gboolean manual_register = FALSE;
char *c_name = NULL;
+ char *c_name_no_underscores;
GOptionContext *context;
GOptionEntry entries[] = {
{ "target", 0, 0, G_OPTION_ARG_FILENAME, &target, N_("name of the output file"), N_("FILE") },
@@ -528,6 +529,10 @@ main (int argc, char **argv)
else
binary_target = g_strdup (target);
+ c_name_no_underscores = c_name;
+ while (c_name_no_underscores && *c_name_no_underscores == '_')
+ c_name_no_underscores++;
+
if (binary_target != NULL &&
!write_to_file (table, binary_target, &error))
{
@@ -602,7 +607,7 @@ main (int argc, char **argv)
"#endif\n"
"\n"
"static const SECTION union { const guint8 data[%"G_GSIZE_FORMAT"]; const double alignment; void * const ptr;} %s_resource_data = { {\n",
- c_name, data_size, c_name);
+ c_name_no_underscores, data_size, c_name);
for (i = 0; i < data_size; i++) {
if (i % 8 == 0)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]