[svn:parrot] r36970 - in trunk: examples/embed src/call t/src
NotFound at svn.parrot.org
NotFound at svn.parrot.org
Tue Feb 24 17:11:24 UTC 2009
Author: NotFound
Date: Tue Feb 24 17:11:24 2009
New Revision: 36970
URL: https://trac.parrot.org/parrot/changeset/36970
Log:
[core] make explicit the assumption about non-empty signatures in src/call/ops.c
Modified:
trunk/examples/embed/lorito.c
trunk/src/call/ops.c
trunk/t/src/embed.t
Modified: trunk/examples/embed/lorito.c
==============================================================================
--- trunk/examples/embed/lorito.c Tue Feb 24 16:27:36 2009 (r36969)
+++ trunk/examples/embed/lorito.c Tue Feb 24 17:11:24 2009 (r36970)
@@ -96,7 +96,7 @@
Parrot_String name = create_string(interp, stname);
Parrot_PMC start = Parrot_PMC_get_pmc_strkey(interp, parrotns, name);
void *discard;
- discard = Parrot_call_sub(interp, start, "");
+ discard = Parrot_call_sub(interp, start, "v");
}
else {
Parrot_runcode(interp, argc - i, argv + i);
Modified: trunk/src/call/ops.c
==============================================================================
--- trunk/src/call/ops.c Tue Feb 24 16:27:36 2009 (r36969)
+++ trunk/src/call/ops.c Tue Feb 24 17:11:24 2009 (r36970)
@@ -203,9 +203,16 @@
interp->current_object = obj;
dest = VTABLE_invoke(interp, sub, NULL);
if (!dest)
- Parrot_ex_throw_from_c_args(interp, NULL, 1,
+ Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_PARROT_USAGE_ERROR,
"Subroutine returned a NULL address");
+ /* The following code assumes that an empty signature is not valid,
+ * check that condition and throws in that case.
+ */
+ if (sig[0] == '\0')
+ Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_PARROT_USAGE_ERROR,
+ "Invalid empty signature");
+
if (PMC_IS_NULL(obj)) {
/* skip over the return type */
sig_p = sig + 1;
Modified: trunk/t/src/embed.t
==============================================================================
--- trunk/t/src/embed.t Tue Feb 24 16:27:36 2009 (r36969)
+++ trunk/t/src/embed.t Tue Feb 24 17:11:24 2009 (r36970)
@@ -93,7 +93,7 @@
"\n",
&errstr
);
- Parrot_call_sub(interp, code, "");
+ Parrot_call_sub(interp, code, "v");
Parrot_destroy(interp);
return 0;
@@ -160,7 +160,7 @@
subname = Parrot_new_string(interp, "hello", 5, (const char *)NULL, 0);
sub = Parrot_PMC_get_pmc_strkey(interp, parrotns, subname);
/* Execute it */
- Parrot_call_sub(interp, sub, "");
+ Parrot_call_sub(interp, sub, "v");
Parrot_destroy(interp);
return 0;
@@ -280,12 +280,12 @@
rootns = Parrot_get_root_namespace(interp);
parrotname = Parrot_new_string(interp, "parrot", 6, (const char *)NULL, 0);
parrotns = Parrot_PMC_get_pmc_strkey(interp, rootns, parrotname);
- hellosub = Parrot_sub_new_from_c_func(interp, (void (*)())& hello, "");
+ hellosub = Parrot_sub_new_from_c_func(interp, (void (*)())& hello, "v");
helloname = Parrot_new_string(interp, "hello", 5, (const char *)NULL, 0);
Parrot_PMC_set_pmc_strkey(interp, parrotns, helloname, hellosub);
/* Call it */
- discard = Parrot_call_sub(interp, code, "");
+ discard = Parrot_call_sub(interp, code, "v");
Parrot_destroy(interp);
return 0;
More information about the parrot-commits
mailing list