Remove wrapper functions for standard C library functions #2499
Replies: 1 comment
-
Yes, this has been on the todo list for a while too. Originally, all the xrdp c files did not include any standard c header files and everything was done through os_call.c, thread_calls.c, etc. The namespace was very clean. Eventually enough contributors complained about things like NULL missing so we started including stdlib.h, stdio.h and string.h. This made most of the wrapping unnecessary. I think the only use now would be for if a function still needs defines. As the comment in os_calls say, put all the defines in there so you don't need then in the main code files. Also I guess if we want extra checks on a call to save code. To make this easier we can change some calls to macros like #define g_memset memset and #define g_memcpy memcpy Also, I have come to regret the g_ prefix once I mixing gtk / gdk headers with os_calls.h. We should have used os_ prefix or maybe xr_ |
Beta Was this translation helpful? Give feedback.
-
At the moment, we're using wrapper functions for many OS-specific (or OS-variant) calls.
I'm proposing we remove the wrapper functions for functions in C99 standard includes. So for example,
g_printf()
(duplicatesprintf()
in stdio.h) would go, as wouldg_memcpy()
(duplicatesmemcpy()
in string.h).Advantages:-
Disadvantages:-
g_strcpy()
). Extra care needs to be taken with these.Thoughts? Is C99 the right standard to aim for?
Beta Was this translation helpful? Give feedback.
All reactions