Skip to content

Commit

Permalink
change back header-only bson
Browse files Browse the repository at this point in the history
  • Loading branch information
Alberto Lerner committed Aug 3, 2010
1 parent 4cb2fac commit c8ae18d
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 43 deletions.
34 changes: 0 additions & 34 deletions bson/bson.cpp

This file was deleted.

5 changes: 2 additions & 3 deletions bson/bsondemo/bsondemo.vcxproj
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
Expand Down Expand Up @@ -170,7 +170,6 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\bson.cpp" />
<ClCompile Include="bsondemo.cpp" />
</ItemGroup>
<ItemGroup>
Expand All @@ -191,4 +190,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>
5 changes: 2 additions & 3 deletions bson/bsondemo/bsondemo.vcxproj.filters
@@ -1,8 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="bsondemo.cpp" />
<ClCompile Include="..\bson.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\ordering.h">
Expand Down Expand Up @@ -50,4 +49,4 @@
<UniqueIdentifier>{ea599740-3c6f-40dd-a121-e825d82ae4aa}</UniqueIdentifier>
</Filter>
</ItemGroup>
</Project>
</Project>
33 changes: 33 additions & 0 deletions bson/inline_decls.h
@@ -0,0 +1,33 @@
// inline.h

/**
* Copyright (C) 2010 10gen Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#pragma once

#if defined(__GNUC__)

#define NOINLINE_DECL __attribute__((noinline))

#elif defined(_MSC_VER)

#define NOINLINE_DECL __declspec(noinline)

#else

#define NOINLINE_DECL

#endif
14 changes: 13 additions & 1 deletion bson/util/builder.h
Expand Up @@ -21,6 +21,8 @@
#include <string.h>
#include <stdio.h>
#include <boost/shared_ptr.hpp>

#include "../inline_decls.h"
#include "../stringdata.h"

namespace mongo {
Expand Down Expand Up @@ -130,7 +132,17 @@ namespace mongo {

private:
/* "slow" portion of 'grow()' */
void grow_reallocate();
void NOINLINE_DECL grow_reallocate(){
int a = size * 2;
if ( a == 0 )
a = 512;
if ( l > a )
a = l + 16 * 1024;
if( a > 64 * 1024 * 1024 )
msgasserted(10000, "BufBuilder grow() > 64MB");
data = (char *) realloc(data, a);
size= a;
}

char *data;
int l;
Expand Down
2 changes: 0 additions & 2 deletions db/jsobj.cpp
Expand Up @@ -40,8 +40,6 @@ BOOST_STATIC_ASSERT( sizeof(double) == 8 );
BOOST_STATIC_ASSERT( sizeof(mongo::Date_t) == 8 );
BOOST_STATIC_ASSERT( sizeof(mongo::OID) == 12 );

#include "../bson/bson.cpp"

namespace mongo {

BSONElement nullElement;
Expand Down

0 comments on commit c8ae18d

Please sign in to comment.