Closed mfederczuk closed 2 years ago
It seems that the proper include for ssize_t
should be #include <sys/types.h>
, but #include <stdint.h>
and #include <stdio.h>
should already define it in a more platform-independent way (non Linux builds).
Hmm, I don't think that there's really a guarantee that ssize_t
will be defined in stdint.h
or stdio.h
, plus sys/types.h
is already being included in fy-atom.c
.
Also, AFAIK ssize_t
is POSIX-only in the first place, so we're already being platform-dependent just by using ssize_t
.
Mmm... You are right :+1: Making the whole library more portable would be another big plus.
Agreed, but that'll be a topic for another day.
For now I'll just change the include to sys/types.h
.
There's another issue with unistd.h, namely that it's not present in non-posix platform likes windows. Neither is sys/types.h available.
I am very surprised you got any compiler errors by a missing ssize_t definition, since the header includes stdio.h
for the definition of FILE, and along that the definition of the fread/fwrite functions which have size_t arguments.
All of these can be handled if I used the HAVE_UNISTD_H autoconf bit, but I don't want to generate the header file to install.
The best I can do is guard with an #ifdef expression, but can't just include either unistd.h or sys/types.h
Added the missing include directive for
unistd.h
inlibfyaml.h
.ssize_t
was used inlibfyaml.h
even thoughunistd.h
was not included, andssize_t
is defined inunistd.h
.I've had the issue that I included
libfyaml.h
before includingunistd.h
, which lead to compiler errors.