perl6-internals
[Top] [All Lists]

[perl #58438] [PATCH] nci can't pass NULL string arguments

To: bugs-bitbucket@netlabs.develooper.com
Subject: [perl #58438] [PATCH] nci can't pass NULL string arguments
From: NotFound (via RT) <parrotbug-followup@parrotcode.org>
Date: Thu, 28 Aug 2008 13:58:27 -0700
Delivered-to: mailing list perl6-all@perl.org
Delivered-to: perl6-all-poster@perl.org
Delivered-to: mailing list perl6-internals@perl.org
Delivered-to: moderator for perl6-internals@perl.org
Delivered-to: perl6-internals@perl.org
In-reply-to: <3a6254190808281358k7ee54520vcd56c320d90e799@mail.gmail.com>
List-help: <mailto:perl6-all-help@perl.org>
List-id: <perl6-all.perl.org>
List-id: <perl6-internals.perl.org>
List-post: <mailto:perl6-all@perl.org>
List-subscribe: <mailto:perl6-all-subscribe@perl.org>
List-unsubscribe: <mailto:perl6-all-unsubscribe@perl.org>
Mail-followup-to: perl6-internals@perl.org
Mailing-list: contact perl6-all-help@perl.org; run by ezmlm
Managed-by: RT 3.6.HEAD (http://www.bestpractical.com/rt/)
References: <RT-Ticket-58438@perl.org> <3a6254190808281358k7ee54520vcd56c320d90e799@mail.gmail.com>
Reply-to: perl6-internals@perl.org
Resent-date: Thu, 28 Aug 2008 13:58:28 -0700
Resent-from: rt-julian.notfound=gmail.com@netlabs.develooper.com
Resent-message-id: <200808282058.m7SKwSc7015253@x17.develooper.com>
Resent-to: perl6-internals@perl.org
Rt-originator: julian.notfound@gmail.com
Rt-ticket: perl #58438
# New Ticket Created by  NotFound 
# Please include the string:  [perl #58438]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=58438 >


I was doing a simple test of NCI calls with the xlib function
XDisplayName, and found that nci can't handle a NULL string argument.
Passing a NULL Parrot String segfaults.

The attached patch passes a NULL char * when a NULL Parrot String is
used. Don't know if this is the desired behaviour, I expect comments.

-- 
Salu2
Index: tools/build/nativecall.pl
===================================================================
--- tools/build/nativecall.pl   (revision 30618)
+++ tools/build/nativecall.pl   (working copy)
@@ -505,8 +505,8 @@
     /t/ && do {
         push @{$temps_ref}, "char *t_$temp_num;";
         push @{$extra_preamble_ref},
-            "t_$temp_num = string_to_cstring(interp, GET_NCI_S($reg_num));";
-        push @{$extra_postamble_ref}, "string_cstring_free(t_$temp_num);";
+            "{STRING * s= GET_NCI_S($reg_num); t_$temp_num = s ? 
string_to_cstring(interp, s) : (char *) NULL;}";
+        push @{$extra_postamble_ref}, "do { if (t_$temp_num) 
string_cstring_free(t_$temp_num); } while (0);";
         return "t_$temp_num";
     };
     /b/ && do {
<Prev in Thread] Current Thread [Next in Thread>
  • [perl #58438] [PATCH] nci can't pass NULL string arguments, via RT <=