~mdw
/
catacomb-perl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Extract Subversion ignore data.
[catacomb-perl]
/
mpstuff.c
diff --git
a/mpstuff.c
b/mpstuff.c
index
094f987
..
9881edc
100644
(file)
--- a/
mpstuff.c
+++ b/
mpstuff.c
@@
-1,6
+1,6
@@
/* -*-c-*-
*
/* -*-c-*-
*
- * $Id
: mpstuff.c,v 1.1 2004/04/02 18:04:01 mdw Exp
$
+ * $Id$
*
* MP manipulation stuff
*
*
* MP manipulation stuff
*
@@
-26,14
+26,6
@@
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-/*----- Revision history --------------------------------------------------*
- *
- * $Log: mpstuff.c,v $
- * Revision 1.1 2004/04/02 18:04:01 mdw
- * Initial checkin.
- *
- */
-
/*----- Header files ------------------------------------------------------*/
#include "catacomb-perl.h"
/*----- Header files ------------------------------------------------------*/
#include "catacomb-perl.h"
@@
-102,12
+94,23
@@
mp *mp_readsv(mp *m, SV *sv, STRLEN *off, int radix)
return (m);
}
return (m);
}
+int group_writesv(group *g, ge *x, SV *sv)
+{
+ mptext_svctx c;
+ int rc;
+ STRLEN len;
+ sv_setpvn(sv, "", 0);
+ c.sv = sv;
+ rc = G_WRITE(g, x, &mptext_svops, &c);
+ return (rc);
+}
+
int mp_writesv(mp *m, SV *sv, int radix)
{
mptext_svctx c;
int rc;
STRLEN len;
int mp_writesv(mp *m, SV *sv, int radix)
{
mptext_svctx c;
int rc;
STRLEN len;
-
SvPV(sv, len
);
+
sv_setpvn(sv, "", 0
);
c.sv = sv;
rc = mp_write(m, radix, &mptext_svops, &c);
return (rc);
c.sv = sv;
rc = mp_write(m, radix, &mptext_svops, &c);
return (rc);
@@
-123,12
+126,13
@@
mp *mp_fromsv(SV *sv, const char *what, int radix, int keep, ...)
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);
croak("%s is not of type Catacomb::MP", SvPVX(t));
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);
}
}
+ if (m && keep)
+ MP_COPY(m);
} else {
if (SvIOK(sv))
m = mp_fromiv(MP_NEW, SvIV(sv));
} else {
if (SvIOK(sv))
m = mp_fromiv(MP_NEW, SvIV(sv));