summaryrefslogtreecommitdiff
path: root/src/util/config/config.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/config/config.cpp')
-rw-r--r--src/util/config/config.cpp13
1 files changed, 3 insertions, 10 deletions
diff --git a/src/util/config/config.cpp b/src/util/config/config.cpp
index a41e455..00a2512 100644
--- a/src/util/config/config.cpp
+++ b/src/util/config/config.cpp
@@ -30,9 +30,7 @@ inline void trim_whitespace( char* buf ) {
}
inline void init_cfg_node( CFG_NODE* node, const char* name, CFG_NODE* parent, U8 type ) {
- memset( node->name, 0, sizeof(node->name) );
- strcpy( node->name, name );
- node->name[sizeof(node->name) - 1] = '\0';
+ node->name = name;
node->parent = parent;
if( parent )
( (CFG_SECTION*)parent )->children.push( node );
@@ -290,17 +288,12 @@ STAT cfg_save( CFG_SECTION* root, const char* path ) {
if( !f )
return STAT_ERR;
- char* buf = (char*)malloc( 999999 );
- buf[0] = 0;
CFG_SERIALIZER s;
s.tabc = 0;
s.f = f;
- cfg_serialize_section( &s, (CFG_NODE*)root, buf );
- U32 len = strlen( buf );
-
- fwrite( buf, 1, len, f );
- free( buf );
+ STR buf = cfg_serialize_section( &s, (CFG_NODE*)root );
+ fwrite( buf, 1, buf.size, f );
fclose( f );
return STAT_OK;