refactor(build): graduate HAVE_LOCALE_H feature

Merge locale.h into os/lang.h
Having a source file with the same name as a system header we use is
considered an anti-pattern.
This commit is contained in:
bfredl
2023-02-27 19:37:43 +01:00
committed by Björn Linse
parent 166b149d5b
commit 1b3c1f6c06
12 changed files with 347 additions and 411 deletions

View File

@@ -29,6 +29,7 @@
#include <ctype.h>
#include <errno.h>
#include <iconv.h>
#include <locale.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
@@ -67,10 +68,6 @@
#include "nvim/types.h"
#include "nvim/vim.h"
#ifdef HAVE_LOCALE_H
# include <locale.h>
#endif
typedef struct {
int rangeStart;
int rangeEnd;
@@ -2193,10 +2190,7 @@ char *enc_locale(void)
if (!(s = nl_langinfo(CODESET)) || *s == NUL)
#endif
{
#if defined(HAVE_LOCALE_H)
if (!(s = setlocale(LC_CTYPE, NULL)) || *s == NUL)
#endif
{
if (!(s = setlocale(LC_CTYPE, NULL)) || *s == NUL) {
if ((s = os_getenv("LC_ALL"))) {
if ((s = os_getenv("LC_CTYPE"))) {
s = os_getenv("LANG");