vbox的更動 31259 路徑 trunk/src/libs/xpcom18a4/nsprpub
- 時間撮記:
- 2010-7-30 下午08:02:05 (14 年 以前)
- 位置:
- trunk/src/libs/xpcom18a4/nsprpub
- 檔案:
-
- 修改 5 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/libs/xpcom18a4/nsprpub/lib/libc/src/strdup.c
r1 r31259 39 39 #include "prmem.h" 40 40 #include <string.h> 41 #ifdef VBOX_USE_IPRT_IN_NSPR 42 #include <iprt/mem.h> 43 #endif 41 44 42 45 PR_IMPLEMENT(char *) … … 51 54 n = strlen(s) + 1; 52 55 56 #ifdef VBOX_USE_IPRT_IN_NSPR 57 rv = (char *)RTMemAlloc(n); 58 #else 53 59 rv = (char *)malloc(n); 60 #endif 54 61 if( (char *)0 == rv ) return rv; 55 62 … … 62 69 PL_strfree(char *s) 63 70 { 71 #ifdef VBOX_USE_IPRT_IN_NSPR 72 RTMemFree(s); 73 #else 64 74 free(s); 75 #endif 65 76 } 66 77 … … 76 87 l = PL_strnlen(s, max); 77 88 89 #ifdef VBOX_USE_IPRT_IN_NSPR 90 rv = (char *)RTMemAlloc(l+1); 91 #else 78 92 rv = (char *)malloc(l+1); 93 #endif 79 94 if( (char *)0 == rv ) return rv; 80 95 -
trunk/src/libs/xpcom18a4/nsprpub/pr/src/io/prlog.c
r11858 r31259 51 51 52 52 #if defined(VBOX) && defined(DEBUG) 53 #include <iprt/initterm.h> /* for RTR3Init */ 54 #include <iprt/log.h> 53 # include <iprt/initterm.h> /* for RTR3Init */ 54 # include <iprt/log.h> 55 #endif 56 #ifdef VBOX_USE_IPRT_IN_NSPR 57 # include <iprt/string.h> 55 58 #endif 56 59 … … 337 340 while (lm != NULL) { 338 341 PRLogModuleInfo *next = lm->next; 342 #ifdef VBOX_USE_IPRT_IN_NSPR 343 RTStrFree((/*const*/ char *)lm->name); 344 #else 339 345 free((/*const*/ char *)lm->name); 346 #endif 340 347 PR_Free(lm); 341 348 lm = next; … … 395 402 lm = PR_NEWZAP(PRLogModuleInfo); 396 403 if (lm) { 404 #ifdef VBOX_USE_IPRT_IN_NSPR 405 lm->name = RTStrDup(name); 406 #else 397 407 lm->name = strdup(name); 408 #endif 398 409 lm->level = PR_LOG_NONE; 399 410 lm->next = logModules; -
trunk/src/libs/xpcom18a4/nsprpub/pr/src/linking/prlink.c
r16397 r31259 113 113 114 114 #endif /* !VBOX_USE_MORE_IPRT_IN_NSPR */ 115 #ifdef VBOX_USE_IPRT_IN_NSPR 116 # include <iprt/mem.h> 117 # include <iprt/string.h> 118 # undef strdup 119 # define strdup(str) RTStrDup(str) 120 #endif 115 121 116 122 #define _PR_DEFAULT_LD_FLAGS PR_LD_LAZY … … 418 424 419 425 if (_pr_currentLibPath) { 426 #ifdef VBOX_USE_IPRT_IN_NSPR 427 RTStrFree(_pr_currentLibPath); 428 #else 420 429 free(_pr_currentLibPath); 430 #endif 421 431 _pr_currentLibPath = NULL; 422 432 } … … 437 447 PR_EnterMonitor(pr_linker_lock); 438 448 if (_pr_currentLibPath) { 449 #ifdef VBOX_USE_IPRT_IN_NSPR 450 RTStrFree(_pr_currentLibPath); 451 #else 439 452 free(_pr_currentLibPath); 453 #endif 440 454 } 441 455 if (path) { … … 488 502 489 503 len = strlen(ev) + 1; /* +1 for the null */ 504 # ifdef VBOX_USE_IPRT_IN_NSPR 505 p = (char*) RTStrAlloc(len); 506 # else 490 507 p = (char*) malloc(len); 508 # endif 491 509 if (p) { 492 510 strcpy(p, ev); … … 519 537 len = strlen(ev) + 1; /* +1 for the null */ 520 538 539 # ifdef VBOX_USE_IPRT_IN_NSPR 540 p = (char*) RTStrAlloc(len); 541 # else 521 542 p = (char*) malloc(len); 543 # endif 522 544 if (p) { 523 545 strcpy(p, ev); … … 530 552 /* AFAIK there isn't a library path with the HP SHL interface --Rob */ 531 553 ev = strdup(""); 532 # endif554 # endif 533 555 #endif 534 556 … … 540 562 exit: 541 563 if (_pr_currentLibPath) { 564 #ifdef VBOX_USE_IPRT_IN_NSPR 565 copy = RTMemDup(_pr_currentLibPath, strlen(_pr_currentLibPath) + 1); 566 #else 542 567 copy = strdup(_pr_currentLibPath); 568 #endif 543 569 } 544 570 PR_ExitMonitor(pr_linker_lock); … … 1475 1501 freeLib: 1476 1502 PR_LOG(_pr_linker_lm, PR_LOG_MIN, ("Unloaded library %s", lib->name)); 1503 #ifdef VBOX_USE_IPRT_IN_NSPR 1504 RTStrFree(lib->name); 1505 #else 1477 1506 free(lib->name); 1507 #endif 1478 1508 lib->name = NULL; 1479 1509 PR_DELETE(lib); -
trunk/src/libs/xpcom18a4/nsprpub/pr/src/malloc/prmem.c
r31253 r31259 41 41 42 42 #include "primpl.h" 43 #ifdef VBOX_USE_ MORE_IPRT_IN_NSPR43 #ifdef VBOX_USE_IPRT_IN_NSPR 44 44 # include <iprt/mem.h> 45 45 #endif … … 108 108 MemBlockHdr *hdr = mz->head; 109 109 mz->head = hdr->s.next; /* unlink it */ 110 #ifdef VBOX_USE_IPRT_IN_NSPR 111 RTMemFree(hdr); 112 #else 110 113 free(hdr); 114 #endif 111 115 mz->elements--; 112 116 } … … 281 285 pthread_mutex_unlock(&mz->lock); 282 286 287 #ifdef VBOX_USE_IPRT_IN_NSPR 288 mb = (MemBlockHdr *)RTMemAlloc(blockSize + 2 * (sizeof *mb)); 289 #else 283 290 mb = (MemBlockHdr *)malloc(blockSize + 2 * (sizeof *mb)); 291 #endif 284 292 if (!mb) { 285 293 PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0); … … 301 309 /* size was too big. Create a block with no zone */ 302 310 blockSize = (size & 15) ? size + 16 - (size & 15) : size; 311 #ifdef VBOX_USE_IPRT_IN_NSPR 312 mb = (MemBlockHdr *)RTMemAlloc(blockSize + 2 * (sizeof *mb)); 313 #else 303 314 mb = (MemBlockHdr *)malloc(blockSize + 2 * (sizeof *mb)); 315 #endif 304 316 if (!mb) { 305 317 PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0); … … 351 363 #endif 352 364 /* We don't know how big it is. But we can fix that. */ 365 #ifdef VBOX_USE_IPRT_IN_NSPR 366 oldptr = RTMemRealloc(oldptr, bytes); 367 #else 353 368 oldptr = realloc(oldptr, bytes); 369 #endif 354 370 if (!oldptr) { 355 371 if (bytes) { … … 384 400 pr_ZoneFree(oldptr); 385 401 else if (oldptr) 402 #ifdef VBOX_USE_IPRT_IN_NSPR 403 RTMemFree(oldptr); 404 #else 386 405 free(oldptr); 406 #endif 387 407 } 388 408 return rv; … … 408 428 "Warning: freeing memory block %p from ordinary malloc\n", ptr); 409 429 #endif 430 #ifdef VBOX_USE_IPRT_IN_NSPR 431 RTMemFree(ptr); 432 #else 410 433 free(ptr); 434 #endif 411 435 return; 412 436 } … … 421 445 PR_ASSERT(blockSize > 65536); 422 446 /* This block was not in any zone. Just free it. */ 447 #ifdef VBOX_USE_IPRT_IN_NSPR 448 RTMemFree(mb); 449 #else 423 450 free(mb); 451 #endif 424 452 return; 425 453 } … … 441 469 if (!_pr_initialized) _PR_ImplicitInitialization(); 442 470 443 #ifdef VBOX_USE_ MORE_IPRT_IN_NSPR471 #ifdef VBOX_USE_IPRT_IN_NSPR 444 472 return use_zone_allocator ? pr_ZoneMalloc(size) : RTMemAlloc(size); 445 473 #else … … 453 481 454 482 return use_zone_allocator ? 455 #ifdef VBOX_USE_ MORE_IPRT_IN_NSPR483 #ifdef VBOX_USE_IPRT_IN_NSPR 456 484 pr_ZoneCalloc(nelem, elsize) : RTMemAllocZ(nelem * (size_t)elsize); 457 485 #else … … 464 492 if (!_pr_initialized) _PR_ImplicitInitialization(); 465 493 466 #ifdef VBOX_USE_ MORE_IPRT_IN_NSPR494 #ifdef VBOX_USE_IPRT_IN_NSPR 467 495 return use_zone_allocator ? pr_ZoneRealloc(ptr, size) : RTMemRealloc(ptr, size); 468 496 #else … … 476 504 pr_ZoneFree(ptr); 477 505 else 478 #ifdef VBOX_USE_ MORE_IPRT_IN_NSPR506 #ifdef VBOX_USE_IPRT_IN_NSPR 479 507 RTMemFree(ptr); 480 508 #else … … 498 526 return PR_MD_malloc( (size_t) size); 499 527 #else 500 # ifdef VBOX_USE_ MORE_IPRT_IN_NSPR528 # ifdef VBOX_USE_IPRT_IN_NSPR 501 529 return RTMemAlloc(size); 502 530 # else … … 512 540 513 541 #else 514 # ifdef VBOX_USE_ MORE_IPRT_IN_NSPR542 # ifdef VBOX_USE_IPRT_IN_NSPR 515 543 return RTMemAllocZ(nelem * (size_t)elsize); 516 544 # else … … 525 553 return PR_MD_realloc( ptr, (size_t) size); 526 554 #else 527 # ifdef VBOX_USE_ MORE_IPRT_IN_NSPR555 # ifdef VBOX_USE_IPRT_IN_NSPR 528 556 return RTMemRealloc(ptr, size); 529 557 # else … … 538 566 PR_MD_free( ptr ); 539 567 #else 540 # ifdef VBOX_USE_ MORE_IPRT_IN_NSPR568 # ifdef VBOX_USE_IPRT_IN_NSPR 541 569 RTMemFree(ptr); 542 570 # else -
trunk/src/libs/xpcom18a4/nsprpub/pr/src/misc/prdtoa.c
r1 r31259 267 267 #endif 268 268 #else 269 # ifdef VBOX_USE_IPRT_IN_NSPR 270 # include <iprt/mem.h> 271 # define MALLOC RTMemAlloc 272 # else 269 273 #define MALLOC malloc 274 # endif 270 275 #endif 271 276 … … 3419 3424 } 3420 3425 freedtoa(result); 3421 return rv; 3426 return rv; 3422 3427 } 3423 3428 … … 3427 3432 ** point value. 3428 3433 ** This should be reparameterized so that you can send in a 3429 ** prcn for the positive and negative ranges. For now, 3434 ** prcn for the positive and negative ranges. For now, 3430 3435 ** conform to the ECMA JavaScript spec which says numbers 3431 3436 ** less than 1e-6 are in scientific notation.
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器