View Single Post
Re: a simple .ini parser
Old
  (#3)
koraX
Member
 
koraX's Avatar
 
Status: Offline
Posts: 145
Join Date: Jan 2004
Location: Slovak Republic
Default Re: a simple .ini parser - 02-01-2005

Some notes :
  • Get rid of pragma once, you already have .h guard defined before it
  • I recommend using C++ constructs, if you are already using classes (malloc -> new, FILE* -> std::fstream, char* -> std::string
  • Wrap your parser in some napespace, so people can use it in their programs without potential conflicts
  • you should trim section name after you remove [ ], example
    Code:
      [   foo]
    will be loaded as " FOO" instead of "FOO"
  • implement removing items
  • realoc is too often, will fragment memory and slow things down. I recommend allocating in blocks, like I'll allocate 10 units at start and if eleventh unit will come, I'll allocate another 10 units, allocating everytime unit comes is IMO slow and ineffective
  • overall it is small good simple program


kXBot
koraX's utils
- see my homepage for other projects (OpenGL CSG Editor, FAT16 Sim, NNetwork Sim, ...)

Last edited by koraX; 02-01-2005 at 12:40..
  
Reply With Quote