mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
refactor: replace '\0' with NUL
This commit is contained in:
parent
2f5b8a0092
commit
a18982cb83
@ -4,6 +4,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "auto/config.h" // IWYU pragma: keep
|
||||
#include "nvim/ascii_defs.h"
|
||||
#include "nvim/base64.h"
|
||||
#include "nvim/memory.h"
|
||||
|
||||
@ -125,7 +126,7 @@ char *base64_encode(const char *src, size_t src_len)
|
||||
dest[out_i] = '=';
|
||||
}
|
||||
|
||||
dest[out_len] = '\0';
|
||||
dest[out_len] = NUL;
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
@ -4208,7 +4208,7 @@ int buf_open_scratch(handle_T bufnr, char *bufname)
|
||||
|
||||
bool buf_is_empty(buf_T *buf)
|
||||
{
|
||||
return buf->b_ml.ml_line_count == 1 && *ml_get_buf(buf, 1) == '\0';
|
||||
return buf->b_ml.ml_line_count == 1 && *ml_get_buf(buf, 1) == NUL;
|
||||
}
|
||||
|
||||
/// Increment b:changedtick value
|
||||
|
@ -1470,7 +1470,7 @@ start:
|
||||
*dst++ = *p++;
|
||||
}
|
||||
}
|
||||
*dst = '\0';
|
||||
*dst = NUL;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1492,6 +1492,6 @@ char *backslash_halve_save(const char *p)
|
||||
*dst++ = *p++;
|
||||
}
|
||||
}
|
||||
*dst = '\0';
|
||||
*dst = NUL;
|
||||
return res;
|
||||
}
|
||||
|
@ -3075,7 +3075,7 @@ static void *call_user_expand_func(user_expand_func_T user_expand_func, expand_T
|
||||
typval_T args[4];
|
||||
const sctx_T save_current_sctx = current_sctx;
|
||||
|
||||
if (xp->xp_arg == NULL || xp->xp_arg[0] == '\0' || xp->xp_line == NULL) {
|
||||
if (xp->xp_arg == NULL || xp->xp_arg[0] == NUL || xp->xp_line == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -8910,7 +8910,7 @@ bool eval_has_provider(const char *feat, bool throw_if_fast)
|
||||
|
||||
char name[32]; // Normalized: "python3_compiled" => "python3".
|
||||
snprintf(name, sizeof(name), "%s", feat);
|
||||
strchrsub(name, '_', '\0'); // Chop any "_xx" suffix.
|
||||
strchrsub(name, '_', NUL); // Chop any "_xx" suffix.
|
||||
|
||||
char buf[256];
|
||||
typval_T tv;
|
||||
|
@ -4118,7 +4118,7 @@ static char *getargcmd(char **argp)
|
||||
|
||||
if (*arg == '+') { // +[command]
|
||||
arg++;
|
||||
if (ascii_isspace(*arg) || *arg == '\0') {
|
||||
if (ascii_isspace(*arg) || *arg == NUL) {
|
||||
command = dollar_command;
|
||||
} else {
|
||||
command = arg;
|
||||
|
@ -510,7 +510,7 @@ char *vim_findfile_stopdir(char *buf)
|
||||
while (*r_ptr != NUL && *r_ptr != ';') {
|
||||
if (r_ptr[0] == '\\' && r_ptr[1] == ';') {
|
||||
// Overwrite the escape char,
|
||||
// use strlen(r_ptr) to move the trailing '\0'.
|
||||
// use strlen(r_ptr) to move the trailing NUL.
|
||||
STRMOVE(r_ptr, r_ptr + 1);
|
||||
r_ptr++;
|
||||
}
|
||||
|
@ -2419,7 +2419,7 @@ char *modname(const char *fname, const char *ext, bool prepend_dot)
|
||||
|
||||
// the file name has at most BASENAMELEN characters.
|
||||
if (strlen(ptr) > BASENAMELEN) {
|
||||
ptr[BASENAMELEN] = '\0';
|
||||
ptr[BASENAMELEN] = NUL;
|
||||
}
|
||||
|
||||
char *s = ptr + strlen(ptr);
|
||||
@ -3330,7 +3330,7 @@ static void vim_mktempdir(void)
|
||||
#endif
|
||||
// If our "root" tempdir is invalid or fails, proceed without "<user>/".
|
||||
// Else user1 could break user2 by creating "/tmp/nvim.user2/".
|
||||
tmp[strlen(tmp) - strlen(user)] = '\0';
|
||||
tmp[strlen(tmp) - strlen(user)] = NUL;
|
||||
}
|
||||
|
||||
// Now try to create "/tmp/nvim.<user>/XXXXXX".
|
||||
|
@ -958,8 +958,8 @@ static void helptags_one(char *dir, const char *ext, const char *tagfname, bool
|
||||
if (s == p2
|
||||
&& (p1 == IObuff || p1[-1] == ' ' || p1[-1] == '\t')
|
||||
&& (vim_strchr(" \t\n\r", (uint8_t)s[1]) != NULL
|
||||
|| s[1] == '\0')) {
|
||||
*p2 = '\0';
|
||||
|| s[1] == NUL)) {
|
||||
*p2 = NUL;
|
||||
p1++;
|
||||
size_t s_len = (size_t)(p2 - p1) + strlen(fname) + 2;
|
||||
s = xmalloc(s_len);
|
||||
|
@ -1174,7 +1174,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
|
||||
break;
|
||||
}
|
||||
vim_memcpy_up(key, key_start, key_len);
|
||||
key[key_len] = '\0';
|
||||
key[key_len] = NUL;
|
||||
linep = skipwhite(linep);
|
||||
|
||||
if (strcmp(key, "NONE") == 0) {
|
||||
@ -1967,7 +1967,7 @@ int syn_name2id_len(const char *name, size_t len)
|
||||
// Avoid using stricmp() too much, it's slow on some systems
|
||||
// Avoid alloc()/free(), these are slow too.
|
||||
vim_memcpy_up(name_u, name, len);
|
||||
name_u[len] = '\0';
|
||||
name_u[len] = NUL;
|
||||
|
||||
// map_get(..., int) returns 0 when no key is present, which is
|
||||
// the expected value for missing highlight group.
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "nvim/ascii_defs.h"
|
||||
#include "nvim/linematch.h"
|
||||
#include "nvim/macros_defs.h"
|
||||
#include "nvim/memory.h"
|
||||
@ -61,7 +62,7 @@ static int matching_chars_iwhite(const char *s1, const char *s2)
|
||||
d++;
|
||||
}
|
||||
}
|
||||
strsproc[k][i] = '\0';
|
||||
strsproc[k][i] = NUL;
|
||||
}
|
||||
int matching = matching_chars(strsproc[0], strsproc[1]);
|
||||
xfree(strsproc[0]);
|
||||
|
@ -46,7 +46,7 @@ static uv_mutex_t mutex;
|
||||
|
||||
static bool log_try_create(char *fname)
|
||||
{
|
||||
if (fname == NULL || fname[0] == '\0') {
|
||||
if (fname == NULL || fname[0] == NUL) {
|
||||
return false;
|
||||
}
|
||||
FILE *log_file = fopen(fname, "a");
|
||||
@ -67,7 +67,7 @@ static void log_path_init(void)
|
||||
size_t size = sizeof(log_file_path);
|
||||
expand_env("$" ENV_LOGFILE, log_file_path, (int)size - 1);
|
||||
if (strequal("$" ENV_LOGFILE, log_file_path)
|
||||
|| log_file_path[0] == '\0'
|
||||
|| log_file_path[0] == NUL
|
||||
|| os_isdir(log_file_path)
|
||||
|| !log_try_create(log_file_path)) {
|
||||
// Make $XDG_STATE_HOME if it does not exist.
|
||||
@ -88,7 +88,7 @@ static void log_path_init(void)
|
||||
}
|
||||
// Fall back to stderr
|
||||
if (len >= size || !log_try_create(log_file_path)) {
|
||||
log_file_path[0] = '\0';
|
||||
log_file_path[0] = NUL;
|
||||
return;
|
||||
}
|
||||
os_setenv(ENV_LOGFILE, log_file_path, true);
|
||||
@ -324,7 +324,7 @@ static bool v_do_log_to_file(FILE *log_file, int log_level, const char *context,
|
||||
|
||||
// Get a name for this Nvim instance.
|
||||
// TODO(justinmk): expose this as v:name ?
|
||||
if (name[0] == '\0') {
|
||||
if (name[0] == NUL) {
|
||||
// Parent servername.
|
||||
const char *parent = path_tail(os_getenv(ENV_NVIM));
|
||||
// Servername. Empty until starting=false.
|
||||
@ -350,7 +350,7 @@ static bool v_do_log_to_file(FILE *log_file, int log_level, const char *context,
|
||||
func_name, line_num);
|
||||
if (name[0] == '?') {
|
||||
// No v:servername yet. Clear `name` so that the next log can try again.
|
||||
name[0] = '\0';
|
||||
name[0] = NUL;
|
||||
}
|
||||
|
||||
if (rv < 0) {
|
||||
|
@ -1500,7 +1500,7 @@ int utf8_to_utf16(const char *utf8, int utf8len, wchar_t **utf16)
|
||||
return uv_translate_sys_error(GetLastError());
|
||||
}
|
||||
|
||||
(*utf16)[bufsize] = L'\0';
|
||||
(*utf16)[bufsize] = LNUL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1546,7 +1546,7 @@ int utf16_to_utf8(const wchar_t *utf16, int utf16len, char **utf8)
|
||||
return uv_translate_sys_error(GetLastError());
|
||||
}
|
||||
|
||||
(*utf8)[bufsize] = '\0';
|
||||
(*utf8)[bufsize] = NUL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -203,7 +203,7 @@ void *xmallocz(size_t size)
|
||||
}
|
||||
|
||||
void *ret = xmalloc(total_size);
|
||||
((char *)ret)[size] = '\0';
|
||||
((char *)ret)[size] = NUL;
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -233,7 +233,7 @@ void *xmemcpyz(void *dst, const void *src, size_t len)
|
||||
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_NONNULL_RET
|
||||
{
|
||||
memcpy(dst, src, len);
|
||||
((char *)dst)[len] = '\0';
|
||||
((char *)dst)[len] = NUL;
|
||||
return dst;
|
||||
}
|
||||
|
||||
@ -241,7 +241,7 @@ void *xmemcpyz(void *dst, const void *src, size_t len)
|
||||
size_t xstrnlen(const char *s, size_t n)
|
||||
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_PURE
|
||||
{
|
||||
const char *end = memchr(s, '\0', n);
|
||||
const char *end = memchr(s, NUL, n);
|
||||
if (end == NULL) {
|
||||
return n;
|
||||
}
|
||||
@ -288,7 +288,7 @@ void *xmemscan(const void *addr, char c, size_t size)
|
||||
void strchrsub(char *str, char c, char x)
|
||||
FUNC_ATTR_NONNULL_ALL
|
||||
{
|
||||
assert(c != '\0');
|
||||
assert(c != NUL);
|
||||
while ((str = strchr(str, c))) {
|
||||
*str++ = x;
|
||||
}
|
||||
@ -388,7 +388,7 @@ char *xstpcpy(char *restrict dst, const char *restrict src)
|
||||
char *xstpncpy(char *restrict dst, const char *restrict src, size_t maxlen)
|
||||
FUNC_ATTR_NONNULL_RET FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ALL
|
||||
{
|
||||
const char *p = memchr(src, '\0', maxlen);
|
||||
const char *p = memchr(src, NUL, maxlen);
|
||||
if (p) {
|
||||
size_t srclen = (size_t)(p - src);
|
||||
memcpy(dst, src, srclen);
|
||||
@ -420,7 +420,7 @@ size_t xstrlcpy(char *restrict dst, const char *restrict src, size_t dsize)
|
||||
if (dsize) {
|
||||
size_t len = MIN(slen, dsize - 1);
|
||||
memcpy(dst, src, len);
|
||||
dst[len] = '\0';
|
||||
dst[len] = NUL;
|
||||
}
|
||||
|
||||
return slen; // Does not include NUL.
|
||||
@ -450,7 +450,7 @@ size_t xstrlcat(char *const dst, const char *const src, const size_t dsize)
|
||||
|
||||
if (slen > dsize - dlen - 1) {
|
||||
memmove(dst + dlen, src, dsize - dlen - 1);
|
||||
dst[dsize - 1] = '\0';
|
||||
dst[dsize - 1] = NUL;
|
||||
} else {
|
||||
memmove(dst + dlen, src, slen + 1);
|
||||
}
|
||||
@ -510,7 +510,7 @@ char *xstrndup(const char *str, size_t len)
|
||||
FUNC_ATTR_MALLOC FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_RET
|
||||
FUNC_ATTR_NONNULL_ALL
|
||||
{
|
||||
char *p = memchr(str, '\0', len);
|
||||
char *p = memchr(str, NUL, len);
|
||||
return xmemdupz(str, p ? (size_t)(p - str) : len);
|
||||
}
|
||||
|
||||
|
@ -2690,7 +2690,7 @@ static void msg_puts_printf(const char *str, const ptrdiff_t maxlen)
|
||||
*p++ = '\r';
|
||||
}
|
||||
memcpy(p, s, (size_t)len);
|
||||
*(p + len) = '\0';
|
||||
*(p + len) = NUL;
|
||||
if (info_message) {
|
||||
printf("%s", buf);
|
||||
} else {
|
||||
|
@ -4725,7 +4725,7 @@ bool do_addsub(int op_type, pos_T *pos, int length, linenr_T Prenum1)
|
||||
buf2[i++] = ((n >> --bits) & 0x1) ? '1' : '0';
|
||||
}
|
||||
|
||||
buf2[i] = '\0';
|
||||
buf2[i] = NUL;
|
||||
} else if (pre == 0) {
|
||||
vim_snprintf(buf2, ARRAY_SIZE(buf2), "%" PRIu64, (uint64_t)n);
|
||||
} else if (pre == '0') {
|
||||
|
@ -724,7 +724,7 @@ static int qf_get_next_str_line(qfstate_T *state)
|
||||
state->linelen = len;
|
||||
}
|
||||
memcpy(state->linebuf, p_str, state->linelen);
|
||||
state->linebuf[state->linelen] = '\0';
|
||||
state->linebuf[state->linelen] = NUL;
|
||||
|
||||
// Increment using len in order to discard the rest of the line if it
|
||||
// exceeds LINE_MAXLEN.
|
||||
|
@ -11495,7 +11495,7 @@ static void nfa_print_state(FILE *debugf, nfa_state_T *state)
|
||||
garray_T indent;
|
||||
|
||||
ga_init(&indent, 1, 64);
|
||||
ga_append(&indent, '\0');
|
||||
ga_append(&indent, NUL);
|
||||
nfa_print_state2(debugf, state, &indent);
|
||||
ga_clear(&indent);
|
||||
}
|
||||
@ -14801,7 +14801,7 @@ static int nfa_regmatch(nfa_regprog_T *prog, nfa_state_T *start, regsubs_T *subm
|
||||
}
|
||||
|
||||
case NFA_ANY:
|
||||
// Any char except '\0', (end of input) does not match.
|
||||
// Any char except NUL, (end of input) does not match.
|
||||
if (curc > 0) {
|
||||
add_state = t->state->out;
|
||||
add_off = clen;
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "nvim/ascii_defs.h"
|
||||
#include "nvim/memory.h"
|
||||
#include "nvim/sha256.h"
|
||||
|
||||
@ -279,7 +280,7 @@ const char *sha256_bytes(const uint8_t *restrict buf, size_t buf_len, const uin
|
||||
for (size_t j = 0; j < SHA256_SUM_SIZE; j++) {
|
||||
snprintf(hexit + j * SHA_STEP, SHA_STEP + 1, "%02x", sha256sum[j]);
|
||||
}
|
||||
hexit[sizeof(hexit) - 1] = '\0';
|
||||
hexit[sizeof(hexit) - 1] = NUL;
|
||||
return hexit;
|
||||
}
|
||||
|
||||
@ -340,7 +341,7 @@ bool sha256_self_test(void)
|
||||
|
||||
if (memcmp(output, sha_self_test_vector[i], SHA256_BUFFER_SIZE) != 0) {
|
||||
failures = true;
|
||||
output[sizeof(output) - 1] = '\0';
|
||||
output[sizeof(output) - 1] = NUL;
|
||||
|
||||
// printf("sha256_self_test %d failed %s\n", i, output);
|
||||
}
|
||||
|
@ -292,8 +292,8 @@ static void sign_list_placed(buf_T *rbuf, char *group)
|
||||
qsort((void *)&kv_A(signs, 0), kv_size(signs), sizeof(MTKey), sign_row_cmp);
|
||||
|
||||
for (size_t i = 0; i < kv_size(signs); i++) {
|
||||
namebuf[0] = '\0';
|
||||
groupbuf[0] = '\0';
|
||||
namebuf[0] = NUL;
|
||||
groupbuf[0] = NUL;
|
||||
MTKey mark = kv_A(signs, i);
|
||||
|
||||
DecorSignHighlight *sh = decor_find_sign(mt_decor(mark));
|
||||
@ -498,7 +498,7 @@ static void sign_list_by_name(char *name)
|
||||
static int sign_place(uint32_t *id, char *group, char *name, buf_T *buf, linenr_T lnum, int prio)
|
||||
{
|
||||
// Check for reserved character '*' in group name
|
||||
if (group != NULL && (*group == '*' || *group == '\0')) {
|
||||
if (group != NULL && (*group == '*' || *group == NUL)) {
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
@ -649,14 +649,14 @@ static void sign_place_cmd(buf_T *buf, linenr_T lnum, char *name, int id, char *
|
||||
// :sign place
|
||||
// :sign place group={group}
|
||||
// :sign place group=*
|
||||
if (lnum >= 0 || name != NULL || (group != NULL && *group == '\0')) {
|
||||
if (lnum >= 0 || name != NULL || (group != NULL && *group == NUL)) {
|
||||
emsg(_(e_invarg));
|
||||
} else {
|
||||
sign_list_placed(buf, group);
|
||||
}
|
||||
} else {
|
||||
// Place a new sign
|
||||
if (name == NULL || buf == NULL || (group != NULL && *group == '\0')) {
|
||||
if (name == NULL || buf == NULL || (group != NULL && *group == NUL)) {
|
||||
emsg(_(e_invarg));
|
||||
return;
|
||||
}
|
||||
@ -668,7 +668,7 @@ static void sign_place_cmd(buf_T *buf, linenr_T lnum, char *name, int id, char *
|
||||
/// ":sign unplace" command
|
||||
static void sign_unplace_cmd(buf_T *buf, linenr_T lnum, const char *name, int id, char *group)
|
||||
{
|
||||
if (lnum >= 0 || name != NULL || (group != NULL && *group == '\0')) {
|
||||
if (lnum >= 0 || name != NULL || (group != NULL && *group == NUL)) {
|
||||
emsg(_(e_invarg));
|
||||
return;
|
||||
}
|
||||
@ -695,7 +695,7 @@ static void sign_jump_cmd(buf_T *buf, linenr_T lnum, const char *name, int id, c
|
||||
return;
|
||||
}
|
||||
|
||||
if (buf == NULL || (group != NULL && *group == '\0') || lnum >= 0 || name != NULL) {
|
||||
if (buf == NULL || (group != NULL && *group == NUL) || lnum >= 0 || name != NULL) {
|
||||
// File or buffer is not specified or an empty group is used
|
||||
// or a line number or a sign name is specified.
|
||||
emsg(_(e_invarg));
|
||||
@ -1316,7 +1316,7 @@ void f_sign_getplaced(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
||||
if (group == NULL) {
|
||||
return;
|
||||
}
|
||||
if (*group == '\0') { // empty string means global group
|
||||
if (*group == NUL) { // empty string means global group
|
||||
group = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -333,7 +333,7 @@ void vim_strcpy_up(char *restrict dst, const char *restrict src)
|
||||
while ((c = (uint8_t)(*src++)) != NUL) {
|
||||
*dst++ = (char)(uint8_t)(c < 'a' || c > 'z' ? c : c - 0x20);
|
||||
}
|
||||
*dst = '\0';
|
||||
*dst = NUL;
|
||||
}
|
||||
|
||||
// strncpy (NUL-terminated) plus vim_strup.
|
||||
@ -344,7 +344,7 @@ void vim_strncpy_up(char *restrict dst, const char *restrict src, size_t n)
|
||||
while (n-- && (c = (uint8_t)(*src++)) != NUL) {
|
||||
*dst++ = (char)(uint8_t)(c < 'a' || c > 'z' ? c : c - 0x20);
|
||||
}
|
||||
*dst = '\0';
|
||||
*dst = NUL;
|
||||
}
|
||||
|
||||
// memcpy (does not NUL-terminate) plus vim_strup.
|
||||
@ -794,10 +794,10 @@ static int format_typeof(const char *type)
|
||||
FUNC_ATTR_NONNULL_ALL
|
||||
{
|
||||
// allowed values: \0, h, l, L
|
||||
char length_modifier = '\0';
|
||||
char length_modifier = NUL;
|
||||
|
||||
// current conversion specifier character
|
||||
char fmt_spec = '\0';
|
||||
char fmt_spec = NUL;
|
||||
|
||||
// parse 'h', 'l', 'll' and 'z' length modifiers
|
||||
if (*type == 'h' || *type == 'l' || *type == 'z') {
|
||||
@ -865,7 +865,7 @@ static int format_typeof(const char *type)
|
||||
} else if (fmt_spec == 'd') {
|
||||
// signed
|
||||
switch (length_modifier) {
|
||||
case '\0':
|
||||
case NUL:
|
||||
case 'h':
|
||||
// char and short arguments are passed as int.
|
||||
return TYPE_INT;
|
||||
@ -879,7 +879,7 @@ static int format_typeof(const char *type)
|
||||
} else {
|
||||
// unsigned
|
||||
switch (length_modifier) {
|
||||
case '\0':
|
||||
case NUL:
|
||||
case 'h':
|
||||
return TYPE_UNSIGNEDINT;
|
||||
case 'l':
|
||||
@ -1050,7 +1050,7 @@ static int parse_fmt_types(const char ***ap_types, int *num_posarg, const char *
|
||||
p += n;
|
||||
} else {
|
||||
// allowed values: \0, h, l, L
|
||||
char length_modifier = '\0';
|
||||
char length_modifier = NUL;
|
||||
|
||||
// variable for positional arg
|
||||
int pos_arg = -1;
|
||||
@ -1441,7 +1441,7 @@ int vim_vsnprintf_typval(char *str, size_t str_m, const char *fmt, va_list ap_st
|
||||
int space_for_positive = 1;
|
||||
|
||||
// allowed values: \0, h, l, 2 (for ll), z, L
|
||||
char length_modifier = '\0';
|
||||
char length_modifier = NUL;
|
||||
|
||||
// temporary buffer for simple numeric->string conversion
|
||||
#define TMP_LEN 350 // 1e308 seems reasonable as the maximum printable
|
||||
@ -1466,7 +1466,7 @@ int vim_vsnprintf_typval(char *str, size_t str_m, const char *fmt, va_list ap_st
|
||||
size_t zero_padding_insertion_ind = 0;
|
||||
|
||||
// current conversion specifier character
|
||||
char fmt_spec = '\0';
|
||||
char fmt_spec = NUL;
|
||||
|
||||
// buffer for 's' and 'S' specs
|
||||
char *tofree = NULL;
|
||||
@ -1669,7 +1669,7 @@ int vim_vsnprintf_typval(char *str, size_t str_m, const char *fmt, va_list ap_st
|
||||
case 'o':
|
||||
case 'x':
|
||||
case 'X':
|
||||
if (tvs && length_modifier == '\0') {
|
||||
if (tvs && length_modifier == NUL) {
|
||||
length_modifier = 'L';
|
||||
}
|
||||
}
|
||||
@ -1790,7 +1790,7 @@ int vim_vsnprintf_typval(char *str, size_t str_m, const char *fmt, va_list ap_st
|
||||
} else if (fmt_spec == 'd') {
|
||||
// signed
|
||||
switch (length_modifier) {
|
||||
case '\0':
|
||||
case NUL:
|
||||
arg = (tvs
|
||||
? (int)tv_nr(tvs, &arg_idx)
|
||||
: (skip_to_arg(ap_types, ap_start, &ap, &arg_idx,
|
||||
@ -1836,7 +1836,7 @@ int vim_vsnprintf_typval(char *str, size_t str_m, const char *fmt, va_list ap_st
|
||||
} else {
|
||||
// unsigned
|
||||
switch (length_modifier) {
|
||||
case '\0':
|
||||
case NUL:
|
||||
uarg = (tvs
|
||||
? (unsigned)tv_nr(tvs, &arg_idx)
|
||||
: (skip_to_arg(ap_types, ap_start, &ap, &arg_idx,
|
||||
@ -2223,7 +2223,7 @@ int vim_vsnprintf_typval(char *str, size_t str_m, const char *fmt, va_list ap_st
|
||||
if (str_m > 0) {
|
||||
// make sure the string is nul-terminated even at the expense of
|
||||
// overwriting the last character (shouldn't happen, but just in case)
|
||||
str[str_l <= str_m - 1 ? str_l : str_m - 1] = '\0';
|
||||
str[str_l <= str_m - 1 ? str_l : str_m - 1] = NUL;
|
||||
}
|
||||
|
||||
if (tvs != NULL
|
||||
|
@ -845,7 +845,7 @@ void terminal_paste(int count, char **y_array, size_t y_size)
|
||||
}
|
||||
char *dst = buff;
|
||||
char *src = y_array[j];
|
||||
while (*src != '\0') {
|
||||
while (*src != NUL) {
|
||||
len = (size_t)utf_ptr2len(src);
|
||||
int c = utf_ptr2char(src);
|
||||
if (!is_filter_char(c)) {
|
||||
|
@ -580,7 +580,7 @@ static void uc_list(char *name, size_t name_len)
|
||||
IObuff[len++] = ' ';
|
||||
} while ((int64_t)len < 25 - over);
|
||||
|
||||
IObuff[len] = '\0';
|
||||
IObuff[len] = NUL;
|
||||
msg_outtrans(IObuff, 0);
|
||||
|
||||
if (cmd->uc_luaref != LUA_NOREF) {
|
||||
@ -831,7 +831,7 @@ invalid_count:
|
||||
}
|
||||
} else {
|
||||
char ch = attr[len];
|
||||
attr[len] = '\0';
|
||||
attr[len] = NUL;
|
||||
semsg(_("E181: Invalid attribute: %s"), attr);
|
||||
attr[len] = ch;
|
||||
return FAIL;
|
||||
@ -1364,7 +1364,7 @@ size_t uc_mods(char *buf, const cmdmod_T *cmod, bool quote)
|
||||
if (quote) {
|
||||
*buf++ = '"';
|
||||
}
|
||||
*buf = '\0';
|
||||
*buf = NUL;
|
||||
}
|
||||
|
||||
// the modifiers that are simple flags
|
||||
|
Loading…
Reference in New Issue
Block a user