We got nominated! Help us out and vote for GitHub as Best Bootstrapped Startup of 2008. (You can vote once a day.) [ hide ]

public
Description: 10gen database
Homepage: http://www.10gen.com/wiki/db
Clone URL: git://github.com/10gen/mongo.git
Revert "safemalloc"

This reverts commit d195086cb879b0251d2203ea75d0250a8a878024.
Dwight (author)
Thu Jul 17 10:23:26 -0700 2008
commit  2612fa547b8c7a83d96d252e2db4cc36f93b7fd8
tree    b67c74eee9029f0f238176f839264370645f76bf
parent  d195086cb879b0251d2203ea75d0250a8a878024
...
404
405
406
407
 
408
409
410
...
404
405
406
 
407
408
409
410
0
@@ -404,7 +404,7 @@ bool BtreeBucket::unindex(const DiskLoc& thisLoc, IndexDetails& id, JSObj& key,
0
 }
0
 
0
 BtreeBucket* BtreeBucket::allocTemp() {
0
- BtreeBucket *b = (BtreeBucket*) safemalloc(BucketSize);
0
+ BtreeBucket *b = (BtreeBucket*) malloc(BucketSize);
0
   b->init();
0
   return b;
0
 }
...
234
235
236
237
 
238
239
240
...
411
412
413
414
 
415
416
417
...
749
750
751
752
 
753
754
755
...
234
235
236
 
237
238
239
240
...
411
412
413
 
414
415
416
417
...
749
750
751
 
752
753
754
755
0
@@ -234,7 +234,7 @@ void receivedQuery(DbResponse& dbresponse, /*AbstractMessagingPort& dbMsgPort, *
0
     problem() << " Caught Assertion in runQuery ns:" << ns << endl;
0
     cout << " ntoskip:" << ntoskip << " ntoreturn:" << ntoreturn << '\n';
0
     cout << " query:" << query.toString() << '\n';
0
- msgdata = (QueryResult*) safemalloc(sizeof(QueryResult));
0
+ msgdata = (QueryResult*) malloc(sizeof(QueryResult));
0
     QueryResult *qr = msgdata;
0
     qr->_data[0] = 0;
0
     qr->_data[1] = 0;
0
@@ -411,7 +411,7 @@ void jniCallback(Message& m, Message& out)
0
         // on a query, the Message must have m.freeIt true so that the buffer data can be
0
         // retained by cursors. As freeIt is false, we make a copy here.
0
         assert( m.data->len > 0 && m.data->len < 32000000 );
0
- Message copy(safemalloc(m.data->len), true);
0
+ Message copy(malloc(m.data->len), true);
0
         memcpy(copy.data, m.data, m.data->len);
0
         DbResponse dbr;
0
         receivedQuery(dbr, copy, ss, false);
0
@@ -749,7 +749,7 @@ void initAndListen(int listenPort, const char *dbPath, const char *appserverLoc
0
      */
0
     
0
     if (dbPath && dbPath[strlen(dbPath)-1] != '/') {
0
- char *t = (char *) safemalloc(strlen(dbPath) + 2);
0
+ char *t = (char *) malloc(strlen(dbPath) + 2);
0
       
0
       strcpy(t, dbPath);
0
       strcat(t, "/");
...
103
104
105
106
 
107
108
109
...
288
289
290
291
 
292
293
294
...
103
104
105
 
106
107
108
109
...
288
289
290
 
291
292
293
294
0
@@ -103,7 +103,7 @@ JavaJSImpl::JavaJSImpl(const char *appserverPath){
0
     ss << colon << getenv( "CLASSPATH" );
0
 
0
   string s = ss.str();
0
- char * p = (char *)safemalloc( s.size() * 4 );
0
+ char * p = (char *)malloc( s.size() * 4 );
0
   strcpy( p , s.c_str() );
0
   char *q = p;
0
 #if defined(_WIN32)
0
@@ -288,7 +288,7 @@ JSObj JavaJSImpl::scopeGetObject( jlong id , const char * field )
0
 {
0
   int guess = _getEnv()->CallStaticIntMethod( _dbhook , _scopeGuessObjectSize , id , _getEnv()->NewStringUTF( field ) );
0
 
0
- char * buf = (char *) safemalloc(guess);
0
+ char * buf = (char *) malloc(guess);
0
   jobject bb = _getEnv()->NewDirectByteBuffer( (void*)buf , guess );
0
   jassert( bb );
0
   
...
510
511
512
513
 
514
515
516
...
510
511
512
 
513
514
515
516
0
@@ -510,7 +510,7 @@ inline JSObj JSObj::copy() {
0
   if( isEmpty() )
0
     return *this;
0
 
0
- char *p = (char*) safemalloc(objsize());
0
+ char *p = (char*) malloc(objsize());
0
   memcpy(p, objdata(), objsize());
0
   return JSObj(p, true);
0
 }
...
138
139
140
141
 
142
143
144
...
138
139
140
 
141
142
143
144
0
@@ -138,7 +138,7 @@ bool MessagingPort::recv(Message& m) {
0
   }
0
         
0
   int z = (len+1023)&0xfffffc00; assert(z>=len);
0
- MsgData *md = (MsgData *) safemalloc(z);
0
+ MsgData *md = (MsgData *) malloc(z);
0
   md->len = len;
0
         
0
   if ( len <= 0 ){
...
140
141
142
143
144
145
146
147
148
149
150
...
140
141
142
 
 
 
 
 
 
 
 
0
@@ -140,11 +140,3 @@ using namespace boost::filesystem;
0
 #include "util/goodies.h"
0
 #include "util/log.h"
0
 
0
-inline void * safemalloc( size_t s ){
0
- void * d = malloc( s );
0
- if ( ! d ){
0
- cerr << "malloc failed" << endl;
0
- assert( 0 );
0
- }
0
- return d;
0
-}

Comments

    No one has commented yet.