[perl-Gnome2-VFS] Avoid misusing PL_na



commit 72cc77ace0b00d91af2622c15bfd67cfd1d979e9
Author: Torsten Schönfeld <kaffeetisch gmx de>
Date:   Wed Sep 25 20:09:36 2013 +0200

    Avoid misusing PL_na

 NEWS                              |    7 +++++++
 vfs2perl.c                        |   14 +++++++-------
 xs/GnomeVFSApplicationRegistry.xs |    6 +++---
 xs/GnomeVFSDNSSD.xs               |   16 ++++++++--------
 xs/GnomeVFSMime.xs                |    4 ++--
 5 files changed, 27 insertions(+), 20 deletions(-)
---
diff --git a/NEWS b/NEWS
index 9ae767f..a92fe8d 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,10 @@
+Overview of changes in Gnome2-VFS <next>
+=======================================
+
+* Avoid misusing the macro PL_na, thus preventing issues when Glib is used in
+  conjunction with certain XS modules, among them XML::Parser and
+  String::Approx.
+
 Overview of changes in Gnome2-VFS 1.081
 =======================================
 
diff --git a/vfs2perl.c b/vfs2perl.c
index 581ffa4..2ac2cce 100644
--- a/vfs2perl.c
+++ b/vfs2perl.c
@@ -232,7 +232,7 @@ newSVGnomeVFSFileInfo (GnomeVFSFileInfo *info)
        HV *object = newHV ();
 
        if (info && info->name && info->valid_fields) {
-               hv_store (object, "name", 4, newSVpv (info->name, PL_na), 0);
+               hv_store (object, "name", 4, newSVpv (info->name, 0), 0);
                hv_store (object, "valid_fields", 12, newSVGnomeVFSFileInfoFields (info->valid_fields), 0);
 
                VFS2PERL_CHECK_AND_STORE (GNOME_VFS_FILE_INFO_FIELDS_TYPE, "type", newSVGnomeVFSFileType 
(info->type));
@@ -247,8 +247,8 @@ newSVGnomeVFSFileInfo (GnomeVFSFileInfo *info)
                VFS2PERL_CHECK_AND_STORE (GNOME_VFS_FILE_INFO_FIELDS_ATIME, "atime", newSViv (info->atime));
                VFS2PERL_CHECK_AND_STORE (GNOME_VFS_FILE_INFO_FIELDS_MTIME, "mtime", newSViv (info->mtime));
                VFS2PERL_CHECK_AND_STORE (GNOME_VFS_FILE_INFO_FIELDS_CTIME, "ctime", newSViv (info->ctime));
-               VFS2PERL_CHECK_AND_STORE (GNOME_VFS_FILE_INFO_FIELDS_SYMLINK_NAME, "symlink_name", newSVpv 
(info->symlink_name, PL_na));
-               VFS2PERL_CHECK_AND_STORE (GNOME_VFS_FILE_INFO_FIELDS_MIME_TYPE, "mime_type", newSVpv 
(info->mime_type, PL_na));
+               VFS2PERL_CHECK_AND_STORE (GNOME_VFS_FILE_INFO_FIELDS_SYMLINK_NAME, "symlink_name", newSVpv 
(info->symlink_name, 0));
+               VFS2PERL_CHECK_AND_STORE (GNOME_VFS_FILE_INFO_FIELDS_MIME_TYPE, "mime_type", newSVpv 
(info->mime_type, 0));
 
                /* FIXME: what about GNOME_VFS_FILE_INFO_FIELDS_ACCESS? */
        }
@@ -350,9 +350,9 @@ newSVGnomeVFSMimeApplication (GnomeVFSMimeApplication *application)
        sv_magic ((SV *) hash, 0, PERL_MAGIC_ext, (const char *) application, 0);
 #endif
 
-       hv_store (hash, "id", 2, newSVpv (application->id, PL_na), 0);
-       hv_store (hash, "name", 4, newSVpv (application->name, PL_na), 0);
-       hv_store (hash, "command", 7, newSVpv (application->command, PL_na), 0);
+       hv_store (hash, "id", 2, newSVpv (application->id, 0), 0);
+       hv_store (hash, "name", 4, newSVpv (application->name, 0), 0);
+       hv_store (hash, "command", 7, newSVpv (application->command, 0), 0);
        hv_store (hash, "can_open_multiple_files", 23, newSVuv (application->can_open_multiple_files), 0);
        hv_store (hash, "expects_uris", 12, newSVGnomeVFSMimeApplicationArgumentType 
(application->expects_uris), 0);
        hv_store (hash, "requires_terminal", 17, newSVuv (application->requires_terminal), 0);
@@ -362,7 +362,7 @@ newSVGnomeVFSMimeApplication (GnomeVFSMimeApplication *application)
                GList *i;
 
                for (i = application->supported_uri_schemes; i != NULL; i = i->next)
-                       av_push (array, newSVpv (i->data, PL_na));
+                       av_push (array, newSVpv (i->data, 0));
 
                hv_store (hash, "supported_uri_schemes", 21, newRV_noinc ((SV *) array), 0);
        }
diff --git a/xs/GnomeVFSApplicationRegistry.xs b/xs/GnomeVFSApplicationRegistry.xs
index edc7f41..e90c244 100644
--- a/xs/GnomeVFSApplicationRegistry.xs
+++ b/xs/GnomeVFSApplicationRegistry.xs
@@ -62,7 +62,7 @@ gnome_vfs_application_registry_get_applications (class, mime_type=NULL)
     PPCODE:
        results = gnome_vfs_application_registry_get_applications (mime_type);
        for (i = results; i != NULL; i = i->next)
-               XPUSHs (sv_2mortal (newSVpv (i->data, PL_na)));
+               XPUSHs (sv_2mortal (newSVpv (i->data, 0)));
        g_list_free (results);
 
 MODULE = Gnome2::VFS::ApplicationRegistry      PACKAGE = Gnome2::VFS::Application      PREFIX = 
gnome_vfs_application_registry_
@@ -86,7 +86,7 @@ gnome_vfs_application_registry_get_keys (app_id)
     PPCODE:
        results = gnome_vfs_application_registry_get_keys (app_id);
        for (i = results; i != NULL; i = i->next)
-               XPUSHs (sv_2mortal (newSVpv (i->data, PL_na)));
+               XPUSHs (sv_2mortal (newSVpv (i->data, 0)));
        g_list_free (results);
 
 ##  const char *gnome_vfs_application_registry_peek_value (const char *app_id, const char *key)
@@ -154,7 +154,7 @@ gnome_vfs_application_registry_get_mime_types (app_id)
     PPCODE:
        results = gnome_vfs_application_registry_get_mime_types (app_id);
        for (i = results; i != NULL; i = i->next)
-               XPUSHs (sv_2mortal (newSVpv (i->data, PL_na)));
+               XPUSHs (sv_2mortal (newSVpv (i->data, 0)));
        g_list_free (results);
 
 ##  gboolean gnome_vfs_application_registry_supports_mime_type (const char *app_id, const char *mime_type) 
diff --git a/xs/GnomeVFSDNSSD.xs b/xs/GnomeVFSDNSSD.xs
index 2e38918..c2e1e4a 100644
--- a/xs/GnomeVFSDNSSD.xs
+++ b/xs/GnomeVFSDNSSD.xs
@@ -29,11 +29,11 @@ newSVGnomeVFSDNSSDService (GnomeVFSDNSSDService *service)
        HV *hv = newHV ();
 
        if (service->name)
-               hv_store (hv, "name", 4, newSVpv (service->name, PL_na), 0);
+               hv_store (hv, "name", 4, newSVpv (service->name, 0), 0);
        if (service->type)
-               hv_store (hv, "type", 4, newSVpv (service->type, PL_na), 0);
+               hv_store (hv, "type", 4, newSVpv (service->type, 0), 0);
        if (service->domain)
-               hv_store (hv, "domain", 6, newSVpv (service->domain, PL_na), 0);
+               hv_store (hv, "domain", 6, newSVpv (service->domain, 0), 0);
 
        return newRV_noinc ((SV *) hv);
 }
@@ -45,7 +45,7 @@ hash_table_foreach (char *key, char *value, HV *hv)
 {
        if (key)
                hv_store (hv, key, strlen (key),
-                         value ? newSVpv (value, PL_na) : &PL_sv_undef, 0);
+                         value ? newSVpv (value, 0) : &PL_sv_undef, 0);
 }
 
 static SV *
@@ -90,7 +90,7 @@ vfs2perl_dns_sd_resolve_callback (GnomeVFSDNSSDResolveHandle *handle,
        PUSHs (sv_2mortal (newSVGnomeVFSDNSSDResolveHandle (handle)));
        PUSHs (sv_2mortal (newSVGnomeVFSResult (result)));
        PUSHs (sv_2mortal (newSVGnomeVFSDNSSDService ((GnomeVFSDNSSDService *) service)));
-       PUSHs (host ? sv_2mortal (newSVpv (host, PL_na)) : &PL_sv_undef);
+       PUSHs (host ? sv_2mortal (newSVpv (host, 0)) : &PL_sv_undef);
        PUSHs (sv_2mortal (newSViv (port)));
        PUSHs (sv_2mortal (newSVGnomeVFSDNSSDResolveHashTable ((GHashTable *) text)));
        PUSHs (text_raw ? sv_2mortal (newSVpv (text_raw, text_raw_len)) : &PL_sv_undef);
@@ -245,7 +245,7 @@ gnome_vfs_dns_sd_resolve_sync (class, name, type, domain, timeout_msec)
 
        EXTEND (sp, 5);
        PUSHs (sv_2mortal (newSVGnomeVFSResult (result)));
-       PUSHs (host ? sv_2mortal (newSVpv (host, PL_na)) : &PL_sv_undef);
+       PUSHs (host ? sv_2mortal (newSVpv (host, 0)) : &PL_sv_undef);
        PUSHs (sv_2mortal (newSViv (port)));
        PUSHs (sv_2mortal (newSVGnomeVFSDNSSDResolveHashTable (text)));
        PUSHs (text_raw ? sv_2mortal (newSVpv (text_raw, text_raw_len)) : &PL_sv_undef);
@@ -273,7 +273,7 @@ gnome_vfs_dns_sd_list_browse_domains_sync (class, domain, timeout_msec)
        if (result == GNOME_VFS_OK) {
                for (i = domains; i; i = i->next) {
                        if (i->data) {
-                               XPUSHs (sv_2mortal (newSVpv (i->data, PL_na)));
+                               XPUSHs (sv_2mortal (newSVpv (i->data, 0)));
                                g_free (i->data);
                        }
                }
@@ -299,7 +299,7 @@ gnome_vfs_get_default_browse_domains (class)
 
        for (i = domains; i; i = i->next) {
                if (i->data) {
-                       XPUSHs (sv_2mortal (newSVpv (i->data, PL_na)));
+                       XPUSHs (sv_2mortal (newSVpv (i->data, 0)));
                        g_free (i->data);
                }
        }
diff --git a/xs/GnomeVFSMime.xs b/xs/GnomeVFSMime.xs
index 392f848..b95e0f9 100644
--- a/xs/GnomeVFSMime.xs
+++ b/xs/GnomeVFSMime.xs
@@ -137,7 +137,7 @@ gnome_vfs_mime_id_list_from_application_list (class, ...)
        ids = gnome_vfs_mime_id_list_from_application_list (applications);
 
        for (j = ids; j != NULL; j = j->next) {
-               XPUSHs (sv_2mortal (newSVpv (j->data, PL_na)));
+               XPUSHs (sv_2mortal (newSVpv (j->data, 0)));
                /* g_free (j->data); */
        }
 
@@ -462,7 +462,7 @@ gnome_vfs_mime_get_all_desktop_entries (mime_type)
 
        for (i = result; i; i = i->next) {
                if (i->data) {
-                       XPUSHs (sv_2mortal (newSVpv (i->data, PL_na)));
+                       XPUSHs (sv_2mortal (newSVpv (i->data, 0)));
                        g_free (i->data);
                }
        }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]