Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-5348

Redefinition of macros while using the C++ driver makes it unusable with larger application code

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical - P2
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.0.5, 2.1.1
    • Component/s: Internal Client
    • Labels:
      None
    • Environment:
      5d3433eb31a58a4fcd242f8a0437819f63df723e
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL

      Description

      when including the C++ driver, some important system calls and macros like 'assert' and 'malloc' get redefined ant not defined back into the original state. Makes using the C++ driver unusable as part of a larger application.

      Will patches to fix this behaviour be accepted?

      1. 1 "/home/piotr/devel/mmcc_mongodb/3rd-party/mongodb/src/mongo/client/../util/allocator.h" 1
      2. 18 "/home/piotr/devel/mmcc_mongodb/3rd-party/mongodb/src/mongo/client/../util/allocator.h"

      namespace mongo {

      inline void * ourmalloc(size_t size)

      { void *x = malloc(size); if ( x == 0 ) dbexit( EXIT_OOM_MALLOC , "malloc fails"); return x; }

      inline void * ourrealloc(void *ptr, size_t size)

      { void *x = realloc(ptr, size); if ( x == 0 ) dbexit( EXIT_OOM_REALLOC , "realloc fails"); return x; }

      #define MONGO_malloc mongo::ourmalloc
      #define malloc MONGO_malloc

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              milkie Eric Milkie
              Reporter:
              piotr Pedro Larroy
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: