chiark
/
gitweb
/
~mdw
/
catacomb-perl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Key mangling, and elliptic curves.
[catacomb-perl]
/
mpstuff.c
diff --git
a/mpstuff.c
b/mpstuff.c
index 34a5b544efa4117cbd15cb791ae75294c7d4770f..c891a76cbfcfea737cc0e6df2cfa199481b5866c 100644
(file)
--- a/
mpstuff.c
+++ b/
mpstuff.c
@@
-1,6
+1,6
@@
/* -*-c-*-
*
/* -*-c-*-
*
- * $Id
: mpstuff.c,v 1.2 2004/04/08 01:36:21 mdw Exp
$
+ * $Id$
*
* MP manipulation stuff
*
*
* MP manipulation stuff
*
@@
-107,19
+107,20
@@
int mp_writesv(mp *m, SV *sv, int radix)
/* --- Conversion to and from SVs --- */
/* --- Conversion to and from SVs --- */
-mp *mp_fromsv(SV *sv, const char *what, int radix, int keep, ...)
+mp *mp_fromsv(SV *sv, const char *what, const char *ty,
+ int radix, int keep, ...)
{
mp *m;
if (SvROK(sv)) {
{
mp *m;
if (SvROK(sv)) {
- if (sv_derived_from(sv, "Catacomb::MP"))
+ if (sv_derived_from(sv, "Catacomb::MP") ||
+ sv_derived_from(sv, "Catacomb::GF"))
m = (mp *)SvIV((SV *)SvRV(sv));
else {
va_list ap;
m = (mp *)SvIV((SV *)SvRV(sv));
else {
va_list ap;
- SV *t =
NEWSV(0, 0
);
+ SV *t =
sv_newmortal(
);
va_start(ap, keep);
sv_vsetpvfn(t, what, strlen(what), &ap, 0, 0, 0);
va_start(ap, keep);
sv_vsetpvfn(t, what, strlen(what), &ap, 0, 0, 0);
- croak("%s is not of type Catacomb::MP", SvPVX(t));
- SvREFCNT_dec(t);
+ croak("%s is not of type %s", SvPVX(t), ty);
}
} else {
if (SvIOK(sv))
}
} else {
if (SvIOK(sv))
@@
-127,7
+128,7
@@
mp *mp_fromsv(SV *sv, const char *what, int radix, int keep, ...)
else
m = mp_readsv(MP_NEW, sv, 0, radix);
if (m && !keep)
else
m = mp_readsv(MP_NEW, sv, 0, radix);
if (m && !keep)
- RET
_MP(m);
/* Kill temporary later */
+ RET
(m, ty);
/* Kill temporary later */
}
return (m);
}
}
return (m);
}