Permalink
Browse files

Stop using old memory management APIs

No need to be concerned about backwards compatibility. Devel::PPPort takes care
of it.
  • Loading branch information...
1 parent fa2d9c2 commit a5f54eafe9396c38f680222eb89f73cbf77ba0dd @rafl rafl committed Dec 18, 2010
Showing with 9 additions and 9 deletions.
  1. +1 −1 mongo_link.c
  2. +1 −1 mongo_link.h
  3. +1 −1 perl_mongo.c
  4. +4 −4 xs/Connection.xs
  5. +2 −2 xs/Cursor.xs
View
@@ -318,7 +318,7 @@ int mongo_link_hear(SV *cursor_sv) {
// point buf.start at buf's first char
if (!cursor->buf.start) {
- New(0, cursor->buf.start, cursor->header.length, char);
+ Newx(cursor->buf.start, cursor->header.length, char);
cursor->buf.end = cursor->buf.start + cursor->header.length;
}
else if (cursor->buf.end - cursor->buf.start < cursor->header.length) {
View
@@ -87,7 +87,7 @@
perl_mongo_serialize_string(&buf, ns, strlen(ns));
#define CREATE_BUF(size) \
- New(0, buf.start, size, char); \
+ Newx(buf.start, size, char); \
buf.pos = buf.start; \
buf.end = buf.start + size;
View
@@ -836,7 +836,7 @@ static stackette* check_circular_ref(void *ptr, stackette *stack) {
}
// push this onto the circular ref stack
- New(0, ette, 1, stackette);
+ Newx(ette, 1, stackette);
ette->ptr = ptr;
// if stack has not been initialized, stack will be 0 so this will work out
ette->prev = start;
View
@@ -108,15 +108,15 @@ _init_conn(self, host, port)
SV *auto_reconnect_sv = 0, *timeout_sv = 0;
mongo_link *link;
CODE:
- New(0, link, 1, mongo_link);
+ Newx(link, 1, mongo_link);
perl_mongo_attach_ptr_to_instance(self, link, &connection_vtbl);
/*
* hosts are of the form:
* [{host => "host", port => 27017}, ...]
*/
- New(0, link->master, 1, mongo_server);
- Newz(0, link->master->host, strlen(host)+1, char);
+ Newx(link->master, 1, mongo_server);
+ Newxz(link->master->host, strlen(host)+1, char);
memcpy(link->master->host, host, strlen(host));
link->master->port = port;
link->master->connected = 0;
@@ -139,7 +139,7 @@ _init_conn_holder(self, master)
PREINIT:
mongo_link *self_link, *master_link;
CODE:
- New(0, self_link, 1, mongo_link);
+ Newx(self_link, 1, mongo_link);
perl_mongo_attach_ptr_to_instance(self, self_link, &connection_vtbl);
master_link = (mongo_link*)perl_mongo_get_ptr_from_instance(master, &connection_vtbl);
View
@@ -115,7 +115,7 @@ static int has_next(SV *self, mongo_cursor *cursor) {
// we have to go and check with the db
size = 34+strlen(SvPV_nolen(ns));
- New(0, buf.start, size, char);
+ Newx(buf.start, size, char);
buf.pos = buf.start;
buf.end = buf.start + size;
@@ -200,7 +200,7 @@ _init (self)
PREINIT:
mongo_cursor *cursor;
CODE:
- New(0, cursor, 1, mongo_cursor);
+ Newx(cursor, 1, mongo_cursor);
cursor->started_iterating = 0;
// zero results fields

0 comments on commit a5f54ea

Please sign in to comment.