Coder Social home page Coder Social logo

cfnptr / conf Goto Github PK

View Code? Open in Web Editor NEW
5.0 5.0 1.0 444 KB

Simple and fast multi-platform configuration file library (similar to .ini)

License: Apache License 2.0

CMake 3.94% C 76.27% Batchfile 0.84% Shell 0.93% C++ 18.02%
c c99 cfg config configuration cpp crossplatform fast file lib library multiplatform reader simple string writer

conf's People

Contributors

cfnptr avatar rtczza avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

rtczza

conf's Issues

Add array support

Possibly use this kind of syntax:
someKey[]=1 2 3

Separate elements by the spaces

Memory leak: data

tests/test_writer.c,error at 90:return false;

Memory should be freed before returning.

69     char* data = malloc(
 70         sizeof(char) *(fileSize + 1));
 71 
 72     if (data == NULL)
 73     {
 74         printf("Failed to allocate read buffer.\n");
 75         closeFile(file);
 76         return false;
 77     }
 78 
 79     size_t readResult = fread(
 80         data,
 81         sizeof(char),
 82         fileSize,
 83         file);
 84 
 85     closeFile(file);
 86 
 87     if (readResult == 0)
 88     {
 89         printf("Failed to read test file.\n");
 90         return false;
 91     }
 92     
 93     data[readResult] = '\0';
 94     
 95     result = strcmp(
 96         confData,
 97         data);
 98 
 99     if (result != 0)
100     {
101         printf("Incorrect value: %s.\n", data);
102         free(data);
103         return false;
104     }
105     
106     free(data);
107     return true;
108 }   

And I fixed the bug by th patch:
avoid-memory-leak.txt

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.