feat!: make iconv a non-optional dep

This commit is contained in:
Lewis Russell 2023-01-23 16:33:45 +00:00 committed by GitHub
parent 3b75485043
commit f08051c2e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 37 additions and 133 deletions

View File

@ -342,11 +342,6 @@ install_helper(
FILES ${CMAKE_SOURCE_DIR}/src/man/nvim.1 FILES ${CMAKE_SOURCE_DIR}/src/man/nvim.1
DESTINATION ${CMAKE_INSTALL_MANDIR}/man1) DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
option(ENABLE_LIBICONV "enable libiconv" ON)
if(ENABLE_LIBICONV)
find_package(Iconv REQUIRED)
endif()
# #
# Go down the tree. # Go down the tree.
# #

View File

@ -51,11 +51,6 @@ check_function_exists(getpwent HAVE_GETPWENT)
check_function_exists(getpwnam HAVE_GETPWNAM) check_function_exists(getpwnam HAVE_GETPWNAM)
check_function_exists(getpwuid HAVE_GETPWUID) check_function_exists(getpwuid HAVE_GETPWUID)
check_function_exists(readv HAVE_READV) check_function_exists(readv HAVE_READV)
if(Iconv_FOUND)
set(HAVE_ICONV 1)
endif()
check_function_exists(opendir HAVE_OPENDIR) check_function_exists(opendir HAVE_OPENDIR)
check_function_exists(readlink HAVE_READLINK) check_function_exists(readlink HAVE_READLINK)
check_function_exists(setpgid HAVE_SETPGID) check_function_exists(setpgid HAVE_SETPGID)

View File

@ -24,7 +24,6 @@
#cmakedefine HAVE_GETPWENT #cmakedefine HAVE_GETPWENT
#cmakedefine HAVE_GETPWNAM #cmakedefine HAVE_GETPWNAM
#cmakedefine HAVE_GETPWUID #cmakedefine HAVE_GETPWUID
#cmakedefine HAVE_ICONV
#cmakedefine HAVE_LANGINFO_H #cmakedefine HAVE_LANGINFO_H
#cmakedefine HAVE_LOCALE_H #cmakedefine HAVE_LOCALE_H
#cmakedefine HAVE_NL_LANGINFO_CODESET #cmakedefine HAVE_NL_LANGINFO_CODESET

View File

@ -45,6 +45,8 @@ The following changes may require adaptations in user config or plugins.
- `printheader` - `printheader`
- `printmbcharset` - `printmbcharset`
• libiconv is now a required build dependency.
============================================================================== ==============================================================================
NEW FEATURES *news-features* NEW FEATURES *news-features*

View File

@ -34,12 +34,9 @@ find_package(LIBVTERM 0.3 REQUIRED)
target_include_directories(main_lib SYSTEM BEFORE INTERFACE ${LIBVTERM_INCLUDE_DIRS}) target_include_directories(main_lib SYSTEM BEFORE INTERFACE ${LIBVTERM_INCLUDE_DIRS})
target_link_libraries(main_lib INTERFACE ${LIBVTERM_LIBRARIES}) target_link_libraries(main_lib INTERFACE ${LIBVTERM_LIBRARIES})
if(Iconv_FOUND) find_package(Iconv REQUIRED)
target_include_directories(main_lib SYSTEM BEFORE INTERFACE ${Iconv_INCLUDE_DIRS}) target_include_directories(main_lib SYSTEM BEFORE INTERFACE ${Iconv_INCLUDE_DIRS})
if(Iconv_LIBRARIES) target_link_libraries(main_lib INTERFACE ${Iconv_LIBRARIES})
target_link_libraries(main_lib INTERFACE ${Iconv_LIBRARIES})
endif()
endif()
option(ENABLE_LIBINTL "enable libintl" ON) option(ENABLE_LIBINTL "enable libintl" ON)
if(ENABLE_LIBINTL) if(ENABLE_LIBINTL)

View File

@ -3082,9 +3082,7 @@ static void f_has(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
"fork", "fork",
#endif #endif
"gettext", "gettext",
#if defined(HAVE_ICONV)
"iconv", "iconv",
#endif
"insert_expand", "insert_expand",
"jumplist", "jumplist",
"keymap", "keymap",

View File

@ -118,9 +118,7 @@ struct bw_info {
int bw_conv_error; // set for conversion error int bw_conv_error; // set for conversion error
linenr_T bw_conv_error_lnum; // first line with error or zero linenr_T bw_conv_error_lnum; // first line with error or zero
linenr_T bw_start_lnum; // line number at start of buffer linenr_T bw_start_lnum; // line number at start of buffer
#ifdef HAVE_ICONV
iconv_t bw_iconv_fd; // descriptor for iconv() or -1 iconv_t bw_iconv_fd; // descriptor for iconv() or -1
#endif
}; };
#ifdef INCLUDE_GENERATED_DECLARATIONS #ifdef INCLUDE_GENERATED_DECLARATIONS
@ -248,11 +246,9 @@ int readfile(char *fname, char *sfname, linenr_T from, linenr_T lines_to_skip,
char *fenc_next = NULL; // next item in 'fencs' or NULL char *fenc_next = NULL; // next item in 'fencs' or NULL
bool advance_fenc = false; bool advance_fenc = false;
long real_size = 0; long real_size = 0;
#ifdef HAVE_ICONV
iconv_t iconv_fd = (iconv_t)-1; // descriptor for iconv() or -1 iconv_t iconv_fd = (iconv_t)-1; // descriptor for iconv() or -1
bool did_iconv = false; // true when iconv() failed and trying bool did_iconv = false; // true when iconv() failed and trying
// 'charconvert' next // 'charconvert' next
#endif
bool converted = false; // true if conversion done bool converted = false; // true if conversion done
bool notconverted = false; // true if conversion wanted but it wasn't possible bool notconverted = false; // true if conversion wanted but it wasn't possible
char conv_rest[CONV_RESTLEN]; char conv_rest[CONV_RESTLEN];
@ -779,13 +775,11 @@ retry:
} }
} }
#ifdef HAVE_ICONV
if (iconv_fd != (iconv_t)-1) { if (iconv_fd != (iconv_t)-1) {
// aborted conversion with iconv(), close the descriptor // aborted conversion with iconv(), close the descriptor
iconv_close(iconv_fd); iconv_close(iconv_fd);
iconv_fd = (iconv_t)-1; iconv_fd = (iconv_t)-1;
} }
#endif
if (advance_fenc) { if (advance_fenc) {
// Try the next entry in 'fileencodings'. // Try the next entry in 'fileencodings'.
@ -838,25 +832,17 @@ retry:
fio_flags = get_fio_flags(fenc); fio_flags = get_fio_flags(fenc);
} }
#ifdef HAVE_ICONV
// Try using iconv() if we can't convert internally. // Try using iconv() if we can't convert internally.
if (fio_flags == 0 if (fio_flags == 0
&& !did_iconv) { && !did_iconv) {
iconv_fd = (iconv_t)my_iconv_open("utf-8", fenc); iconv_fd = (iconv_t)my_iconv_open("utf-8", fenc);
} }
#endif
// Use the 'charconvert' expression when conversion is required // Use the 'charconvert' expression when conversion is required
// and we can't do it internally or with iconv(). // and we can't do it internally or with iconv().
if (fio_flags == 0 && !read_stdin && !read_buffer && *p_ccv != NUL if (fio_flags == 0 && !read_stdin && !read_buffer && *p_ccv != NUL
&& !read_fifo && !read_fifo && iconv_fd == (iconv_t)-1) {
#ifdef HAVE_ICONV
&& iconv_fd == (iconv_t)-1
#endif
) {
#ifdef HAVE_ICONV
did_iconv = false; did_iconv = false;
#endif
// Skip conversion when it's already done (retry for wrong // Skip conversion when it's already done (retry for wrong
// "fileformat"). // "fileformat").
if (tmpname == NULL) { if (tmpname == NULL) {
@ -874,11 +860,7 @@ retry:
} }
} }
} else { } else {
if (fio_flags == 0 if (fio_flags == 0 && iconv_fd == (iconv_t)-1) {
#ifdef HAVE_ICONV
&& iconv_fd == (iconv_t)-1
#endif
) {
// Conversion wanted but we can't. // Conversion wanted but we can't.
// Try the next conversion in 'fileencodings' // Try the next conversion in 'fileencodings'
advance_fenc = true; advance_fenc = true;
@ -961,12 +943,9 @@ retry:
// ucs-4 to utf-8: 4 bytes become up to 6 bytes, size must be // ucs-4 to utf-8: 4 bytes become up to 6 bytes, size must be
// multiple of 4 // multiple of 4
real_size = (int)size; real_size = (int)size;
#ifdef HAVE_ICONV
if (iconv_fd != (iconv_t)-1) { if (iconv_fd != (iconv_t)-1) {
size = size / ICONV_MULT; size = size / ICONV_MULT;
} else { } else if (fio_flags & FIO_LATIN1) {
#endif
if (fio_flags & FIO_LATIN1) {
size = size / 2; size = size / 2;
} else if (fio_flags & (FIO_UCS2 | FIO_UTF16)) { } else if (fio_flags & (FIO_UCS2 | FIO_UTF16)) {
size = (size * 2 / 3) & ~1; size = (size * 2 / 3) & ~1;
@ -975,9 +954,7 @@ retry:
} else if (fio_flags == FIO_UCSBOM) { } else if (fio_flags == FIO_UCSBOM) {
size = size / ICONV_MULT; // worst case size = size / ICONV_MULT; // worst case
} }
#ifdef HAVE_ICONV
}
#endif
if (conv_restlen > 0) { if (conv_restlen > 0) {
// Insert unconverted bytes from previous line. // Insert unconverted bytes from previous line.
memmove(ptr, conv_rest, (size_t)conv_restlen); // -V614 memmove(ptr, conv_rest, (size_t)conv_restlen); // -V614
@ -1049,11 +1026,7 @@ retry:
// not be converted. Truncated file? // not be converted. Truncated file?
// When we did a conversion report an error. // When we did a conversion report an error.
if (fio_flags != 0 if (fio_flags != 0 || iconv_fd != (iconv_t)-1) {
#ifdef HAVE_ICONV
|| iconv_fd != (iconv_t)-1
#endif
) {
if (can_retry) { if (can_retry) {
goto rewind_retry; goto rewind_retry;
} }
@ -1074,23 +1047,17 @@ retry:
// character if we were converting; if we weren't, // character if we were converting; if we weren't,
// leave the UTF8 checking code to do it, as it // leave the UTF8 checking code to do it, as it
// works slightly differently. // works slightly differently.
if (bad_char_behavior != BAD_KEEP && (fio_flags != 0 if (bad_char_behavior != BAD_KEEP && (fio_flags != 0 || iconv_fd != (iconv_t)-1)) {
#ifdef HAVE_ICONV
|| iconv_fd != (iconv_t)-1
#endif
)) { // NOLINT(whitespace/parens)
while (conv_restlen > 0) { while (conv_restlen > 0) {
*(--ptr) = (char)bad_char_behavior; *(--ptr) = (char)bad_char_behavior;
conv_restlen--; conv_restlen--;
} }
} }
fio_flags = 0; // don't convert this fio_flags = 0; // don't convert this
#ifdef HAVE_ICONV
if (iconv_fd != (iconv_t)-1) { if (iconv_fd != (iconv_t)-1) {
iconv_close(iconv_fd); iconv_close(iconv_fd);
iconv_fd = (iconv_t)-1; iconv_fd = (iconv_t)-1;
} }
#endif
} }
} }
} }
@ -1155,7 +1122,6 @@ retry:
break; break;
} }
#ifdef HAVE_ICONV
if (iconv_fd != (iconv_t)-1) { if (iconv_fd != (iconv_t)-1) {
// Attempt conversion of the read bytes to 'encoding' using iconv(). // Attempt conversion of the read bytes to 'encoding' using iconv().
const char *fromp = ptr; const char *fromp = ptr;
@ -1202,7 +1168,6 @@ retry:
memmove(line_start, buffer, (size_t)linerest); memmove(line_start, buffer, (size_t)linerest);
size = (top - ptr); size = (top - ptr);
} }
#endif
if (fio_flags != 0) { if (fio_flags != 0) {
unsigned int u8c; unsigned int u8c;
@ -1420,12 +1385,12 @@ retry:
if (can_retry && !incomplete_tail) { if (can_retry && !incomplete_tail) {
break; break;
} }
#ifdef HAVE_ICONV
// When we did a conversion report an error. // When we did a conversion report an error.
if (iconv_fd != (iconv_t)-1 && conv_error == 0) { if (iconv_fd != (iconv_t)-1 && conv_error == 0) {
conv_error = readfile_linenr(linecnt, ptr, (char *)p); conv_error = readfile_linenr(linecnt, ptr, (char *)p);
} }
#endif
// Remember the first linenr with an illegal byte // Remember the first linenr with an illegal byte
if (conv_error == 0 && illegal_byte == 0) { if (conv_error == 0 && illegal_byte == 0) {
illegal_byte = readfile_linenr(linecnt, ptr, (char *)p); illegal_byte = readfile_linenr(linecnt, ptr, (char *)p);
@ -1448,17 +1413,13 @@ retry:
// Detected a UTF-8 error. // Detected a UTF-8 error.
rewind_retry: rewind_retry:
// Retry reading with another conversion. // Retry reading with another conversion.
#ifdef HAVE_ICONV
if (*p_ccv != NUL && iconv_fd != (iconv_t)-1) { if (*p_ccv != NUL && iconv_fd != (iconv_t)-1) {
// iconv() failed, try 'charconvert' // iconv() failed, try 'charconvert'
did_iconv = true; did_iconv = true;
} else { } else {
#endif // use next item from 'fileencodings'
// use next item from 'fileencodings' advance_fenc = true;
advance_fenc = true; }
#ifdef HAVE_ICONV
}
#endif
file_rewind = true; file_rewind = true;
goto retry; goto retry;
} }
@ -1683,11 +1644,9 @@ failed:
if (fenc_alloced) { if (fenc_alloced) {
xfree(fenc); xfree(fenc);
} }
#ifdef HAVE_ICONV
if (iconv_fd != (iconv_t)-1) { if (iconv_fd != (iconv_t)-1) {
iconv_close(iconv_fd); iconv_close(iconv_fd);
} }
#endif
if (!read_buffer && !read_stdin) { if (!read_buffer && !read_stdin) {
close(fd); // errors are ignored close(fd); // errors are ignored
@ -2233,9 +2192,7 @@ int buf_write(buf_T *buf, char *fname, char *sfname, linenr_T start, linenr_T en
write_info.bw_conv_error = false; write_info.bw_conv_error = false;
write_info.bw_conv_error_lnum = 0; write_info.bw_conv_error_lnum = 0;
write_info.bw_restlen = 0; write_info.bw_restlen = 0;
#ifdef HAVE_ICONV
write_info.bw_iconv_fd = (iconv_t)-1; write_info.bw_iconv_fd = (iconv_t)-1;
#endif
// After writing a file changedtick changes but we don't want to display // After writing a file changedtick changes but we don't want to display
// the line. // the line.
@ -2996,7 +2953,6 @@ nobackup:
} }
if (converted && wb_flags == 0) { if (converted && wb_flags == 0) {
#ifdef HAVE_ICONV
// Use iconv() conversion when conversion is needed and it's not done // Use iconv() conversion when conversion is needed and it's not done
// internally. // internally.
write_info.bw_iconv_fd = (iconv_t)my_iconv_open(fenc, "utf-8"); write_info.bw_iconv_fd = (iconv_t)my_iconv_open(fenc, "utf-8");
@ -3009,28 +2965,21 @@ nobackup:
} }
write_info.bw_first = true; write_info.bw_first = true;
} else { } else {
#endif // When the file needs to be converted with 'charconvert' after
// writing, write to a temp file instead and let the conversion
// When the file needs to be converted with 'charconvert' after // overwrite the original file.
// writing, write to a temp file instead and let the conversion if (*p_ccv != NUL) {
// overwrite the original file. wfname = vim_tempname();
if (*p_ccv != NUL) { if (wfname == NULL) { // Can't write without a tempfile!
wfname = vim_tempname(); SET_ERRMSG(_("E214: Can't find temp file for writing"));
if (wfname == NULL) { // Can't write without a tempfile! goto restore_backup;
SET_ERRMSG(_("E214: Can't find temp file for writing")); }
goto restore_backup;
} }
} }
} }
#ifdef HAVE_ICONV
}
#endif
if (converted && wb_flags == 0 if (converted && wb_flags == 0
#ifdef HAVE_ICONV
&& write_info.bw_iconv_fd == (iconv_t)-1 && write_info.bw_iconv_fd == (iconv_t)-1
#endif
&& wfname == fname) { && wfname == fname) {
if (!forceit) { if (!forceit) {
SET_ERRMSG(_("E213: Cannot convert (add ! to write without conversion)")); SET_ERRMSG(_("E213: Cannot convert (add ! to write without conversion)"));
@ -3551,12 +3500,10 @@ nofail:
} }
xfree(fenc_tofree); xfree(fenc_tofree);
xfree(write_info.bw_conv_buf); xfree(write_info.bw_conv_buf);
#ifdef HAVE_ICONV
if (write_info.bw_iconv_fd != (iconv_t)-1) { if (write_info.bw_iconv_fd != (iconv_t)-1) {
iconv_close(write_info.bw_iconv_fd); iconv_close(write_info.bw_iconv_fd);
write_info.bw_iconv_fd = (iconv_t)-1; write_info.bw_iconv_fd = (iconv_t)-1;
} }
#endif
#ifdef HAVE_ACL #ifdef HAVE_ACL
os_free_acl(acl); os_free_acl(acl);
#endif #endif
@ -3801,7 +3748,7 @@ static bool time_differs(const FileInfo *file_info, long mtime, long mtime_ns) F
|| file_info->stat.st_mtim.tv_sec - mtime > 1 || file_info->stat.st_mtim.tv_sec - mtime > 1
|| mtime - file_info->stat.st_mtim.tv_sec > 1; || mtime - file_info->stat.st_mtim.tv_sec > 1;
#else #else
|| (long)file_info->stat.st_mtim.tv_sec != mtime; || file_info->stat.st_mtim.tv_sec != mtime;
#endif #endif
} }
@ -3914,7 +3861,6 @@ static int buf_write_bytes(struct bw_info *ip)
} }
} }
#ifdef HAVE_ICONV
if (ip->bw_iconv_fd != (iconv_t)-1) { if (ip->bw_iconv_fd != (iconv_t)-1) {
const char *from; const char *from;
size_t fromlen; size_t fromlen;
@ -3973,7 +3919,6 @@ static int buf_write_bytes(struct bw_info *ip)
buf = ip->bw_conv_buf; buf = ip->bw_conv_buf;
len = (int)(to - ip->bw_conv_buf); len = (int)(to - ip->bw_conv_buf);
} }
#endif
} }
if (ip->bw_fd < 0) { if (ip->bw_fd < 0) {

View File

@ -1,20 +1,18 @@
#ifndef NVIM_ICONV_H #ifndef NVIM_ICONV_H
#define NVIM_ICONV_H #define NVIM_ICONV_H
#include <errno.h>
#include <iconv.h>
#include "auto/config.h" #include "auto/config.h"
#ifdef HAVE_ICONV
# include <errno.h>
# include <iconv.h>
// define some missing constants if necessary // define some missing constants if necessary
# ifndef EILSEQ #ifndef EILSEQ
# define EILSEQ 123 # define EILSEQ 123
# endif
# define ICONV_ERRNO errno
# define ICONV_E2BIG E2BIG
# define ICONV_EINVAL EINVAL
# define ICONV_EILSEQ EILSEQ
#endif #endif
#define ICONV_ERRNO errno
#define ICONV_E2BIG E2BIG
#define ICONV_EINVAL EINVAL
#define ICONV_EILSEQ EILSEQ
#endif // NVIM_ICONV_H #endif // NVIM_ICONV_H

View File

@ -482,8 +482,6 @@ static int nlua_stricmp(lua_State *const lstate) FUNC_ATTR_NONNULL_ALL
return 1; return 1;
} }
#if defined(HAVE_ICONV)
/// Convert string from one encoding to another /// Convert string from one encoding to another
static int nlua_iconv(lua_State *lstate) static int nlua_iconv(lua_State *lstate)
{ {
@ -526,8 +524,6 @@ static int nlua_iconv(lua_State *lstate)
return 1; return 1;
} }
#endif
void nlua_state_add_stdlib(lua_State *const lstate, bool is_thread) void nlua_state_add_stdlib(lua_State *const lstate, bool is_thread)
{ {
if (!is_thread) { if (!is_thread) {
@ -574,12 +570,10 @@ void nlua_state_add_stdlib(lua_State *const lstate, bool is_thread)
luaopen_spell(lstate); luaopen_spell(lstate);
lua_setfield(lstate, -2, "spell"); lua_setfield(lstate, -2, "spell");
#if defined(HAVE_ICONV)
// vim.iconv // vim.iconv
// depends on p_ambw, p_emoji // depends on p_ambw, p_emoji
lua_pushcfunction(lstate, &nlua_iconv); lua_pushcfunction(lstate, &nlua_iconv);
lua_setfield(lstate, -2, "iconv"); lua_setfield(lstate, -2, "iconv");
#endif
} }
// vim.mpack // vim.mpack

View File

@ -2263,8 +2263,6 @@ enc_locale_copy_enc:
return enc_canonize(buf); return enc_canonize(buf);
} }
#if defined(HAVE_ICONV)
// Call iconv_open() with a check if iconv() works properly (there are broken // Call iconv_open() with a check if iconv() works properly (there are broken
// versions). // versions).
// Returns (void *)-1 if failed. // Returns (void *)-1 if failed.
@ -2272,7 +2270,7 @@ enc_locale_copy_enc:
void *my_iconv_open(char *to, char *from) void *my_iconv_open(char *to, char *from)
{ {
iconv_t fd; iconv_t fd;
# define ICONV_TESTLEN 400 #define ICONV_TESTLEN 400
char tobuf[ICONV_TESTLEN]; char tobuf[ICONV_TESTLEN];
char *p; char *p;
size_t tolen; size_t tolen;
@ -2386,8 +2384,6 @@ static char *iconv_string(const vimconv_T *const vcp, const char *str, size_t sl
return result; return result;
} }
#endif // HAVE_ICONV
/// Setup "vcp" for conversion from "from" to "to". /// Setup "vcp" for conversion from "from" to "to".
/// The names must have been made canonical with enc_canonize(). /// The names must have been made canonical with enc_canonize().
/// vcp->vc_type must have been initialized to CONV_NONE. /// vcp->vc_type must have been initialized to CONV_NONE.
@ -2412,11 +2408,9 @@ int convert_setup_ext(vimconv_T *vcp, char *from, bool from_unicode_is_utf8, cha
int to_is_utf8; int to_is_utf8;
// Reset to no conversion. // Reset to no conversion.
#ifdef HAVE_ICONV
if (vcp->vc_type == CONV_ICONV && vcp->vc_fd != (iconv_t)-1) { if (vcp->vc_type == CONV_ICONV && vcp->vc_fd != (iconv_t)-1) {
iconv_close(vcp->vc_fd); iconv_close(vcp->vc_fd);
} }
#endif
*vcp = (vimconv_T)MBYTE_NONE_CONV; *vcp = (vimconv_T)MBYTE_NONE_CONV;
// No conversion when one of the names is empty or they are equal. // No conversion when one of the names is empty or they are equal.
@ -2452,9 +2446,7 @@ int convert_setup_ext(vimconv_T *vcp, char *from, bool from_unicode_is_utf8, cha
} else if (from_is_utf8 && (to_prop & ENC_LATIN9)) { } else if (from_is_utf8 && (to_prop & ENC_LATIN9)) {
// Internal utf-8 -> latin9 conversion. // Internal utf-8 -> latin9 conversion.
vcp->vc_type = CONV_TO_LATIN9; vcp->vc_type = CONV_TO_LATIN9;
} } else {
#ifdef HAVE_ICONV
else { // NOLINT(readability/braces)
// Use iconv() for conversion. // Use iconv() for conversion.
vcp->vc_fd = (iconv_t)my_iconv_open(to_is_utf8 ? "utf-8" : to, vcp->vc_fd = (iconv_t)my_iconv_open(to_is_utf8 ? "utf-8" : to,
from_is_utf8 ? "utf-8" : from); from_is_utf8 ? "utf-8" : from);
@ -2463,7 +2455,6 @@ int convert_setup_ext(vimconv_T *vcp, char *from, bool from_unicode_is_utf8, cha
vcp->vc_factor = 4; // could be longer too... vcp->vc_factor = 4; // could be longer too...
} }
} }
#endif
if (vcp->vc_type == CONV_NONE) { if (vcp->vc_type == CONV_NONE) {
return FAIL; return FAIL;
} }
@ -2626,11 +2617,9 @@ char *string_convert_ext(const vimconv_T *const vcp, char *ptr, size_t *lenp, si
} }
break; break;
#ifdef HAVE_ICONV
case CONV_ICONV: // conversion with vcp->vc_fd case CONV_ICONV: // conversion with vcp->vc_fd
retval = (char_u *)iconv_string(vcp, ptr, len, unconvlenp, lenp); retval = (char_u *)iconv_string(vcp, ptr, len, unconvlenp, lenp);
break; break;
#endif
} }
return (char *)retval; return (char *)retval;

View File

@ -46,9 +46,7 @@ typedef enum {
typedef struct { typedef struct {
int vc_type; ///< Zero or more ConvFlags. int vc_type; ///< Zero or more ConvFlags.
int vc_factor; ///< Maximal expansion factor. int vc_factor; ///< Maximal expansion factor.
#ifdef HAVE_ICONV
iconv_t vc_fd; ///< Value for CONV_ICONV. iconv_t vc_fd; ///< Value for CONV_ICONV.
#endif
bool vc_fail; ///< What to do with invalid characters: if true, fail, bool vc_fail; ///< What to do with invalid characters: if true, fail,
///< otherwise use '?'. ///< otherwise use '?'.
} vimconv_T; } vimconv_T;

View File

@ -63,12 +63,6 @@ static char *features[] = {
"-acl", "-acl",
#endif #endif
#if defined(HAVE_ICONV)
"+iconv",
#else
"-iconv",
#endif
"+tui", "+tui",
NULL NULL
}; };