From 70aaf2537de4fba3c7c15efbceefd41892185482 Mon Sep 17 00:00:00 2001 From: Tony Cook Date: Tue, 15 Apr 2008 07:56:46 +0000 Subject: [PATCH] - extra tests to distinguish errno problems from P::X::Q:A bugs, possibly leading to a workaround https://rt.cpan.org/Ticket/Display.html?id=35044 --- Array.xs | 12 ++++++++++++ Changes | 5 +++++ MANIFEST | 1 + alloc.c | 8 ++++---- queue.c | 11 +++++++++++ queue.h | 3 +++ 6 files changed, 36 insertions(+), 4 deletions(-) diff --git a/Array.xs b/Array.xs index 338f828..6d515aa 100644 --- a/Array.xs +++ b/Array.xs @@ -176,3 +176,15 @@ pq_dump(pq) void pq_verify(pq) POE::XS::Queue::Array pq + +# these are for testing errno is being set correctly for perl when +# set from XS +void +pq__set_errno_xs(value) + int value + CODE: + errno = value; + +void +pq__set_errno_queue(value) + int value diff --git a/Changes b/Changes index 066f662..a102818 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,10 @@ Revision history for Perl extension POE::XS::Queue::Array. +0.005 unreleased + - extra tests to distinguish errno problems from P::X::Q:A bugs, + possibly leading to a workaround + https://rt.cpan.org/Ticket/Display.html?id=35044 + 0.004 Wed Apr 9 2008 - include license information in appropriate places - fix @ISA, it was badly broken, thanks to Yuval Kogman (nothingmuch) diff --git a/MANIFEST b/MANIFEST index 4c67629..4e34d1d 100644 --- a/MANIFEST +++ b/MANIFEST @@ -12,6 +12,7 @@ queue.c Moved the implementation code here queue.h t/01_array.t t/02_release.t +t/03_errno.t t/90_pod.t t/91_pod_cover.t typemap diff --git a/alloc.c b/alloc.c index d2bee61..b23b3de 100644 --- a/alloc.c +++ b/alloc.c @@ -237,15 +237,15 @@ mymalloc(size_t size) { void *buf; if (size < 0) { - fprintf(stderr, "Attempt to allocate size %d\n", size); + fprintf(stderr, "Attempt to allocate size %d\n", (int)size); exit(3); } if ( (buf = malloc(size)) == NULL ) { - mm_log((1, "mymalloc: unable to malloc %d\n", size)); - fprintf(stderr,"Unable to malloc %d.\n", size); exit(3); + mm_log((1, "mymalloc: unable to malloc %d\n", (int)size)); + fprintf(stderr,"Unable to malloc %d.\n", (int)size); exit(3); } - mm_log((1, "mymalloc(size %d) -> %p\n", size, buf)); + mm_log((1, "mymalloc(size %d) -> %p\n", (int)size, buf)); return buf; } diff --git a/queue.c b/queue.c index 9a8230f..f56140f 100644 --- a/queue.c +++ b/queue.c @@ -830,3 +830,14 @@ pq_verify(poe_queue *pq) { exit(1); } } + +/* +pq__set_errno_queue - set errno + +This just sets errno for testing purposes. +*/ +void +pq__set_errno_queue(int value) { + errno = value; +} + diff --git a/queue.h b/queue.h index 036eb9e..62a4328 100644 --- a/queue.h +++ b/queue.h @@ -37,4 +37,7 @@ pq_peek_items(poe_queue *pq, SV *filter, int max_count, pq_entry **items); extern void pq_dump(poe_queue *pq); extern void pq_verify(poe_queue *pq); +extern void +pq__set_errno_queue(int value); + #endif -- 2.39.2