[vlc-devel] [PATCH 2/3] posix: add a replacement for strerror_l
Rémi Denis-Courmont
remi at remlab.net
Sat Sep 12 20:07:34 CEST 2015
Le 2015-09-12 20:23, Sean McGovern a écrit :
> This function is new for POSIX 2008.
> See:
>
> https://www.gnu.org/software/gnulib/manual/html_node/strerror_005fl.html.
> ---
> compat/strerror_l.c | 37 +++++++++++++++++++++++++++++++++++++
> configure.ac | 2 +-
> include/vlc_fixups.h | 5 +++++
> 3 files changed, 43 insertions(+), 1 deletion(-)
> create mode 100644 compat/strerror_l.c
>
> diff --git a/compat/strerror_l.c b/compat/strerror_l.c
> new file mode 100644
> index 0000000..6ef7f63
> --- /dev/null
> +++ b/compat/strerror_l.c
> @@ -0,0 +1,37 @@
>
> +/*****************************************************************************
> + * strerror_l.c: POSIX.1-2008 strerror_l replacement
> +
>
> *****************************************************************************
No copyrights?!
> + *
> + * This program is free software; you can redistribute it and/or
> modify it
> + * under the terms of the GNU Lesser General Public License as
> published by
> + * the Free Software Foundation; either version 2.1 of the License,
> or
> + * (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> License
> + * along with this program; if not, write to the Free Software
> Foundation,
> + * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
> +
>
> *****************************************************************************/
> +
> +#ifdef HAVE_CONFIG_H
> +# include <config.h>
> +#endif
> +
> +#include <errno.h>
> +#include <locale.h>
> +
> +/* See:
>
> http://pubs.opengroup.org/onlinepubs/9699919799/functions/strerror_l.html
> */
> +char *strerror_l(int errnum, locale_t locale)
> +{
> +#ifdef strerror_l
That does not make sense.
> + return strerror_l(errnum, locale);
> +#else
> + errno = ENOSYS;
> + return NULL;
This patch is for retarded OSes, and yet I doubt that all retarded OSes
would have ENOSYS. (Not sure about <locale.h> either.)
> +#endif
> +}
> +
--
Rémi Denis-Courmont
http://www.remlab.net/
More information about the vlc-devel
mailing list