]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
json_spirit: Use ceph_assert for asserts.
authorAdam C. Emerson <aemerson@redhat.com>
Thu, 23 Aug 2018 15:24:12 +0000 (11:24 -0400)
committerAdam C. Emerson <aemerson@redhat.com>
Mon, 27 Aug 2018 13:35:43 +0000 (09:35 -0400)
Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
src/json_spirit/json_spirit_reader_template.h
src/json_spirit/json_spirit_writer_template.h

index c50f885ec0de90f9810d0675d6dd3e7b80006ee1..c0d3b90f0721dcd9c37eb74644cb53791b234fdb 100644 (file)
@@ -37,6 +37,8 @@
     #define spirit_namespace boost::spirit\r
 #endif\r
 \r
+#include "include/assert.h"\r
+\r
 namespace json_spirit\r
 {\r
     const spirit_namespace::int_parser < boost::int64_t >  int64_p  = spirit_namespace::int_parser < boost::int64_t  >();\r
@@ -177,7 +179,7 @@ namespace json_spirit
     String_type get_str_( typename String_type::const_iterator begin, \r
                        typename String_type::const_iterator end )\r
     {\r
-        assert( end - begin >= 2 );\r
+        ceph_assert( end - begin >= 2 );\r
 \r
         typedef typename String_type::const_iterator Iter_type;\r
 \r
@@ -233,35 +235,35 @@ namespace json_spirit
 \r
         void begin_obj( Char_type c )\r
         {\r
-            assert( c == '{' );\r
+            ceph_assert( c == '{' );\r
 \r
             begin_compound< Object_type >();\r
         }\r
 \r
         void end_obj( Char_type c )\r
         {\r
-            assert( c == '}' );\r
+            ceph_assert( c == '}' );\r
 \r
             end_compound();\r
         }\r
 \r
         void begin_array( Char_type c )\r
         {\r
-            assert( c == '[' );\r
+            ceph_assert( c == '[' );\r
      \r
             begin_compound< Array_type >();\r
         }\r
 \r
         void end_array( Char_type c )\r
         {\r
-            assert( c == ']' );\r
+            ceph_assert( c == ']' );\r
 \r
             end_compound();\r
         }\r
 \r
         void new_name( Iter_type begin, Iter_type end )\r
         {\r
-            assert( current_p_->type() == obj_type );\r
+            ceph_assert( current_p_->type() == obj_type );\r
 \r
             name_ = get_str< String_type >( begin, end );\r
         }\r
@@ -273,21 +275,21 @@ namespace json_spirit
 \r
         void new_true( Iter_type begin, Iter_type end )\r
         {\r
-            assert( is_eq( begin, end, "true" ) );\r
+            ceph_assert( is_eq( begin, end, "true" ) );\r
 \r
             add_to_current( true );\r
         }\r
 \r
         void new_false( Iter_type begin, Iter_type end )\r
         {\r
-            assert( is_eq( begin, end, "false" ) );\r
+            ceph_assert( is_eq( begin, end, "false" ) );\r
 \r
             add_to_current( false );\r
         }\r
 \r
         void new_null( Iter_type begin, Iter_type end )\r
         {\r
-            assert( is_eq( begin, end, "null" ) );\r
+            ceph_assert( is_eq( begin, end, "null" ) );\r
 \r
             add_to_current( Value_type() );\r
         }\r
@@ -314,7 +316,7 @@ namespace json_spirit
 \r
         Value_type* add_first( const Value_type& value )\r
         {\r
-            assert( current_p_ == 0 );\r
+            ceph_assert( current_p_ == 0 );\r
 \r
             value_ = value;\r
             current_p_ = &value_;\r
@@ -361,7 +363,7 @@ namespace json_spirit
                 return &current_p_->get_array().back(); \r
             }\r
             \r
-            assert( current_p_->type() == obj_type );\r
+            ceph_assert( current_p_->type() == obj_type );\r
 \r
             return &Config_type::add( current_p_->get_obj(), name_, value );\r
         }\r
@@ -586,7 +588,7 @@ namespace json_spirit
 \r
         if( !info.hit )\r
         {\r
-            assert( false ); // in theory exception should already have been thrown\r
+            ceph_assert( false ); // in theory exception should already have been thrown\r
             throw_error( info.stop, "error" );\r
         }\r
 \r
index c66037e1f9f78fc7aa1425c28ec1b372441923d2..4eec0b4ea6632a334aabb1d31d4d358511a1e798 100644 (file)
 #include "json_spirit_value.h"\r
 #include "json_spirit_writer_options.h"\r
 \r
-#include <cassert>\r
 #include <sstream>\r
 #include <iomanip>\r
 #include <boost/io/ios_state.hpp>\r
 \r
+#include "include/assert.h"\r
+\r
 namespace json_spirit\r
 {\r
     inline char to_hex_char( unsigned int c )\r
     {\r
-        assert( c <= 0xF );\r
+        ceph_assert( c <= 0xF );\r
 \r
         const char ch = static_cast< char >( c );\r
 \r
@@ -193,7 +194,7 @@ namespace json_spirit
                 case real_type:  output( value.get_real() );  break;\r
                 case int_type:   output_int( value );         break;\r
                 case null_type:  os_ << "null";               break;\r
-                default: assert( false );\r
+                default: ceph_assert( false );\r
             }\r
         }\r
 \r