Skip to content

renaming strtonum to str2num to avoid conflict with BSD libc#3

Open
ryanavella wants to merge 1 commit intoomnister:masterfrom
ryanavella:master
Open

renaming strtonum to str2num to avoid conflict with BSD libc#3
ryanavella wants to merge 1 commit intoomnister:masterfrom
ryanavella:master

Conversation

@ryanavella
Copy link
Contributor

I received this error while compiling on FreeBSD

readshpfont.c:97:5: error: conflicting types for 'strtonum'
   97 | int strtonum(char *str) {
      |     ^~~~~~~~
In file included from readshpfont.c:6:
/usr/include/stdlib.h:318:2: note: previous declaration of 'strtonum' was here
  318 |  strtonum(const char *, long long, long long, const char **);
      |  ^~~~~~~~
gmake: *** [<builtin>: readshpfont.o] Error 1

Upon further investigation, it looks like all of the BSD's provide a function strtonum in their stdlib.h. It is not only a name conflict but also a signature conflict. FreeBSD's strtonum takes 4 arguments instead of 1.

Changing strtonum to str2num fixes this.

@omnister
Copy link
Owner

omnister commented Jan 4, 2024

Fixed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants