Giter Site home page Giter Site logo

ctable's People

Contributors

phochmann avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

ctable's Issues

Return value from `malloc_row` is not checked for NULL

Possible extension: fprint_table

The function void print_table(Table *table) prints to stdout.
stdout is like any FILE pointer though.
Possible new function could be void fprint_table(FILE *stream, Table *table) that does the same as print_table but a different FILE pointer can be specified.

The naming mirrors the relationship of printf and fprintf where fprintf is the same but allows any FILE pointer to be used.

vec_create function does not check malloc return value for NULL

The function vec_create calls malloc but does not check the return value for NULL:

https://github.com/PhilippHochmann/ctable/blob/e9ac72d79177474be4b28f7584f2e5aefc5f6f2e/src/vector.c#L25-L38

vec_create is called by strbuilder_create is called by add_cell_vfmt which can pass the NULL as the text argument to add_cell_internal where it is assigned to the text member of a Cell struct (last line below):

https://github.com/PhilippHochmann/ctable/blob/e9ac72d79177474be4b28f7584f2e5aefc5f6f2e/src/table.c#L15-L24

This seems to create a large separation between where the problem is created (NULL returned from malloc) and where the problem will be noticed.

Example source

The README should mention that the code to generate the tables in the example images can be seen in tests/test_table.c

Even better would be showing example usage code in the README.md or a standalone example file.

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.