GithubHelp home page GithubHelp logo

asprintf.c's People

Contributors

jwerle avatar ryzhyk avatar stephenmathieson avatar sunny2023 avatar

Stargazers

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

Watchers

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

asprintf.c's Issues

add travis

mind if I add travis? config should be super simple:

language: c
script: make check

warning: missing field 'fp_offset' initializer

there's no need to set args = {{0}}:

cc deps/asprintf/asprintf.c -c -o deps/asprintf/asprintf.o -std=c99 -Wall -Wextra -Ideps
deps/asprintf/asprintf.c:19:21: warning: missing field 'fp_offset' initializer [-Wmissing-field-initializers]
  va_list args = {{0}};
                    ^
deps/asprintf/asprintf.c:36:21: warning: missing field 'fp_offset' initializer [-Wmissing-field-initializers]
  va_list tmpa = {{0}};
                    ^
2 warnings generated.

Some issues.

asprintf is available on both GNU and FreeBSD. Nowever, they
have slightly differently. You should document this functions
exact behaviour.


The line

size = vsnprintf(NULL, size, fmt, tmpa);

should be changed to

size = vsnprintf(NULL, 0, fmt, tmpa);

for clarity.


The line

*str = (char *) malloc(size + 1);

should be changed to

*str = malloc((size + 1) * sizeof(char));

C allows sizeof(char) > 1. And there is no need
to cast void*, it just makes it less readable. You
can remove the C++ style comments when you
are at it making to more like C and less like C++.


Please do not use Yoda-statements.


Whilst your implementation is POSIX-compliant,
it is better to measure the resulting string with %zn.


Most C standard library implementations implements asprintf.
I don't know about Microsoft's implementations, but apart from
that Plan 9 is the only notable except, but Plan 9's library is quite
different. So this packages feels quite unnecessary, one could
just use a normal libc, or use gnulib.

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.