Fix/add more files with to clint-files.txt

This commit is contained in:
Thiago de Arruda 2014-04-08 07:01:44 -03:00
parent 0805911434
commit 1fc7d6a0c5
17 changed files with 90 additions and 75 deletions

View File

@ -1,2 +1,19 @@
src/indent.c
src/indent.h
src/os/env.c
src/os/event.c
src/os/event_defs.h
src/os/event.h
src/os/input.c
src/os/input.h
src/os/job.c
src/os/job_defs.h
src/os/job.h
src/os/mem.c
src/os/os.h
src/os/shell.c
src/os/shell.h
src/os/signal.c
src/os/signal.h
src/os/time.c
src/os/time.h

View File

@ -741,7 +741,7 @@ EXTERN int swap_exists_action INIT(= SEA_NONE);
EXTERN int swap_exists_did_quit INIT(= FALSE);
/* Selected "quit" at the dialog. */
EXTERN char_u *IObuff; /* sprintf's are done in this buffer,
EXTERN char_u IObuff[IOSIZE]; /* sprintf's are done in this buffer,
size is IOSIZE */
EXTERN char_u *NameBuff; /* file names are expanded in this
* buffer, size is MAXPATHL */

View File

@ -31,7 +31,7 @@ int get_indent_lnum(linenr_T lnum)
// "buf".
int get_indent_buf(buf_T *buf, linenr_T lnum)
{
return get_indent_str(ml_get_buf(buf, lnum, FALSE), (int)buf->b_p_ts);
return get_indent_str(ml_get_buf(buf, lnum, false), (int)buf->b_p_ts);
}
@ -64,7 +64,7 @@ int get_indent_str(char_u *ptr, int ts)
// SIN_INSERT: insert the indent in front of the line.
// SIN_UNDO: save line for undo before changing it.
// @param size measured in spaces
// Returns TRUE if the line was changed.
// Returns true if the line was changed.
int set_indent(int size, int flags)
{
char_u *p;
@ -74,10 +74,10 @@ int set_indent(int size, int flags)
int todo;
int ind_len; // Measured in characters.
int line_len;
int doit = FALSE;
int doit = false;
int ind_done = 0; // Measured in spaces.
int tab_pad;
int retval = FALSE;
int retval = false;
// Number of initial whitespace chars when 'et' and 'pi' are both set.
int orig_char_len = -1;
@ -129,7 +129,7 @@ int set_indent(int size, int flags)
tab_pad = (int)curbuf->b_p_ts - (ind_done % (int)curbuf->b_p_ts);
if ((todo >= tab_pad) && (orig_char_len == -1)) {
doit = TRUE;
doit = true;
todo -= tab_pad;
ind_len++;
@ -140,7 +140,7 @@ int set_indent(int size, int flags)
// Count tabs required for indent.
while (todo >= (int)curbuf->b_p_ts) {
if (*p != TAB) {
doit = TRUE;
doit = true;
} else {
p++;
}
@ -154,7 +154,7 @@ int set_indent(int size, int flags)
// Count spaces required for indent.
while (todo > 0) {
if (*p != ' ') {
doit = TRUE;
doit = true;
} else {
p++;
}
@ -166,7 +166,7 @@ int set_indent(int size, int flags)
// Return if the indent is OK already.
if (!doit && !vim_iswhite(*p) && !(flags & SIN_INSERT)) {
return FALSE;
return false;
}
// Allocate memory for the new line.
@ -256,7 +256,7 @@ int set_indent(int size, int flags)
// Replace the line (unless undo fails).
if (!(flags & SIN_UNDO) || (u_savesub(curwin->w_cursor.lnum) == OK)) {
ml_replace(curwin->w_cursor.lnum, newline, FALSE);
ml_replace(curwin->w_cursor.lnum, newline, false);
if (flags & SIN_CHANGED) {
changed_bytes(curwin->w_cursor.lnum, 0);
@ -275,7 +275,7 @@ int set_indent(int size, int flags)
saved_cursor.col = (colnr_T)(s - newline);
}
}
retval = TRUE;
retval = true;
} else {
vim_free(newline);
}
@ -286,7 +286,7 @@ int set_indent(int size, int flags)
// Copy the indent from ptr to the current line (and fill to size).
// Leaves the cursor on the first non-blank in the line.
// @return TRUE if the line was changed.
// @return true if the line was changed.
int copy_indent(int size, char_u *src)
{
char_u *p = NULL;
@ -376,11 +376,11 @@ int copy_indent(int size, char_u *src)
memmove(p, ml_get_curline(), (size_t)line_len);
// Replace the line
ml_replace(curwin->w_cursor.lnum, line, FALSE);
ml_replace(curwin->w_cursor.lnum, line, false);
// Put the cursor after the indent.
curwin->w_cursor.col = ind_len;
return TRUE;
return true;
}
@ -401,12 +401,12 @@ int get_number_indent(linenr_T lnum)
// In format_lines() (i.e. not insert mode), fo+=q is needed too...
if ((State & INSERT) || has_format_option(FO_Q_COMS)) {
lead_len = get_leader_len(ml_get(lnum), NULL, FALSE, TRUE);
lead_len = get_leader_len(ml_get(lnum), NULL, false, true);
}
regmatch.regprog = vim_regcomp(curbuf->b_p_flp, RE_MAGIC);
if (regmatch.regprog != NULL) {
regmatch.rm_ic = FALSE;
regmatch.rm_ic = false;
// vim_regexec() expects a pointer to a line. This lets us
// start matching for the flp beyond any comment leader...
@ -426,9 +426,9 @@ int get_number_indent(linenr_T lnum)
}
// When extra == 0: Return TRUE if the cursor is before or on the first
// When extra == 0: Return true if the cursor is before or on the first
// non-blank in the line.
// When extra == 1: Return TRUE if the cursor is before the first non-blank in
// When extra == 1: Return true if the cursor is before the first non-blank in
// the line.
int inindent(int extra)
{
@ -440,9 +440,9 @@ int inindent(int extra)
}
if (col >= curwin->w_cursor.col + extra) {
return TRUE;
return true;
} else {
return FALSE;
return false;
}
}
@ -500,7 +500,7 @@ int get_expr_indent(void)
// code in lisp-like languages than the traditional one; it's still
// mostly heuristics however -- Dirk van Deun, dirk@rave.org
// TODO:
// TODO(unknown):
// Findmatch() should be adapted for lisp, also to make showmatch
// work correctly: now (v5.3) it seems all C/C++ oriented:
// - it does not recognize the #\( and #\) notations as character literals
@ -637,11 +637,9 @@ int get_lisp_indent(void)
if (vi_lisp || ((*that != '"') && (*that != '\'')
&& (*that != '#') && ((*that < '0') || (*that > '9')))) {
while (*that && (!vim_iswhite(*that) || quotecount || parencount)
&& (!((*that == '(' || *that == '[')
&& !quotecount && !parencount && vi_lisp))) {
if (*that == '"') {
quotecount = !quotecount;
}
@ -691,8 +689,8 @@ static int lisp_match(char_u *p)
len = (int)STRLEN(buf);
if ((STRNCMP(buf, p, len) == 0) && (p[len] == ' ')) {
return TRUE;
return true;
}
}
return FALSE;
return false;
}

View File

@ -11,4 +11,4 @@ int get_number_indent(linenr_T lnum);
int inindent(int extra);
int get_expr_indent(void);
int get_lisp_indent(void);
#endif
#endif // NEOVIM_INDENT_H

View File

@ -1516,7 +1516,6 @@ static void init_startuptime(mparm_T *paramp)
*/
static void allocate_generic_buffers(void)
{
IObuff = alloc(IOSIZE);
NameBuff = alloc(MAXPATHL);
TIME_MSG("Allocated generic buffers");
}

View File

@ -369,7 +369,6 @@ void free_all_mem(void)
clear_hl_tables();
vim_free(IObuff);
vim_free(NameBuff);
}

View File

@ -55,12 +55,12 @@ char *os_getenvname_at_index(size_t index)
}
long os_get_pid()
int64_t os_get_pid()
{
#ifdef _WIN32
return (long)GetCurrentProcessId();
return (int64_t)GetCurrentProcessId();
#else
return (long)getpid();
return (int64_t)getpid();
#endif
}
@ -76,7 +76,8 @@ void os_get_hostname(char *hostname, size_t len)
hostname[len - 1] = '\0';
}
#else
// TODO: Implement this for windows. See the implementation used in vim:
// TODO(unknown): Implement this for windows.
// See the implementation used in vim:
// https://code.google.com/p/vim/source/browse/src/os_win32.c?r=6b69d8dde19e32909f4ee3a6337e6a2ecfbb6f72#2899
*hostname = '\0';
#endif

View File

@ -60,7 +60,7 @@ bool event_poll(int32_t ms)
if (ms > 0) {
// Calculate remaining time in milliseconds
remaining = (end - uv_hrtime()) / 1e6;
remaining = (end - uv_hrtime()) / 1e6;
}
if (input_ready() || got_int) {
@ -69,7 +69,7 @@ bool event_poll(int32_t ms)
}
if (!result || (ms >= 0 && remaining <= 0)) {
// Or if we timed out
// Or if we timed out
return false;
}
}
@ -133,11 +133,10 @@ static bool poll_uv_loop(int32_t ms)
uv_run(uv_default_loop(), run_mode);
} while (
// Continue running if ...
!input_ready() && // we have no input
kl_empty(event_queue) && // no events are waiting to be processed
run_mode != UV_RUN_NOWAIT && // ms != 0
!timed_out // we didn't get a timeout
);
!input_ready() && // we have no input
kl_empty(event_queue) && // no events are waiting to be processed
run_mode != UV_RUN_NOWAIT && // ms != 0
!timed_out); // we didn't get a timeout
input_stop();

View File

@ -16,4 +16,4 @@ typedef struct {
} data;
} Event;
#endif // NEOVIM_OS_EVENT_H
#endif // NEOVIM_OS_EVENT_DEFS_H

View File

@ -154,7 +154,7 @@ int os_inchar(char_u *buf, int maxlen, int32_t ms, int tb_change_cnt)
return 0;
}
return read_from_input_buf(buf, (long)maxlen);
return read_from_input_buf(buf, (int64_t)maxlen);
}
// Check if a character is available for reading
@ -168,7 +168,7 @@ bool os_char_avail()
void os_breakcheck()
{
if (curr_tmode == TMODE_RAW && event_poll(0))
fill_input_buf(FALSE);
fill_input_buf(false);
}
// This is a replacement for the old `WaitForChar` function in os_unix.c

View File

@ -3,8 +3,8 @@
#include <uv.h>
#include "os/job_defs.h"
#include "os/job.h"
#include "os/job_defs.h"
#include "os/time.h"
#include "os/shell.h"
#include "vim.h"
@ -17,13 +17,13 @@
/// Possible lock states of the job buffer
typedef enum {
kBufferLockNone = 0, ///< No data was read
kBufferLockStdout, ///< Data read from stdout
kBufferLockStderr ///< Data read from stderr
kBufferLockNone = 0, ///< No data was read
kBufferLockStdout, ///< Data read from stdout
kBufferLockStderr ///< Data read from stderr
} BufferLock;
struct _Job {
// Job id the index in the job table plus one.
struct job {
// Job id the index in the job table plus one.
int id;
// Number of polls after a SIGTERM that will trigger a SIGKILL
int exit_timeout;
@ -83,7 +83,7 @@ void job_teardown()
uv_process_kill(&job->proc, SIGTERM);
}
}
if (all_dead) {
return;
}
@ -120,7 +120,7 @@ int job_start(char **argv, void *data, job_read_cb cb)
{
int i;
Job *job;
// Search for a free slot in the table
for (i = 0; i < MAX_RUNNING_JOBS; i++) {
if (table[i] == NULL) {
@ -133,7 +133,7 @@ int job_start(char **argv, void *data, job_read_cb cb)
return 0;
}
job = xmalloc(sizeof(Job));
job = xmalloc(sizeof(Job));
// Initialize
job->id = i + 1;
job->data = data;
@ -245,7 +245,7 @@ static Job * find_job(int id)
if (id <= 0 || id > MAX_RUNNING_JOBS) {
return NULL;
}
return table[id - 1];
}
@ -269,7 +269,7 @@ static void job_prepare_cb(uv_prepare_t *handle, int status)
if ((job = table[i]) == NULL || !job->stopped) {
continue;
}
if ((job->exit_timeout--) == EXIT_TIMEOUT) {
// Job was just stopped, close all stdio handles and send SIGTERM
uv_process_kill(&job->proc, SIGTERM);

View File

@ -47,7 +47,7 @@ int job_start(char **argv, void *data, job_read_cb cb);
/// Terminates a job. This is a non-blocking operation, but if the job exists
/// it's guaranteed to succeed(SIGKILL will eventually be sent)
///
///
/// @param id The job id
/// @return true if the stop request was successfully sent, false if the job
/// id is invalid(probably because it has already stopped)

View File

@ -1,6 +1,6 @@
#ifndef NEOVIM_OS_JOB_DEFS_H
#define NEOVIM_OS_JOB_DEFS_H
typedef struct _Job Job;
typedef struct job Job;
#endif // NEOVIM_OS_JOB_DEFS_H

View File

@ -86,7 +86,7 @@ char *os_getenvname_at_index(size_t index);
/// Get the process ID of the Neovim process.
///
/// @return the process ID.
long os_get_pid(void);
int64_t os_get_pid(void);
/// Get the hostname of the machine runing Neovim.
///

View File

@ -103,7 +103,7 @@ void shell_free_argv(char **argv)
}
while (*p != NULL) {
// Free each argument
// Free each argument
free(*p);
p++;
}
@ -138,9 +138,9 @@ int os_call_shell(char_u *cmd, ShellOpts opts, char_u *extra_shell_arg)
signal_reject_deadly();
// Create argv for `uv_spawn`
// TODO we can use a static buffer for small argument vectors. 1024 bytes
// should be enough for most of the commands and if more is necessary we can
// allocate a another buffer
// TODO(tarruda): we can use a static buffer for small argument vectors. 1024
// bytes should be enough for most of the commands and if more is necessary
// we can allocate a another buffer
proc_opts.args = shell_build_argv(cmd, extra_shell_arg);
proc_opts.file = proc_opts.args[0];
proc_opts.exit_cb = exit_cb;
@ -219,8 +219,9 @@ int os_call_shell(char_u *cmd, ShellOpts opts, char_u *extra_shell_arg)
if (got_int) {
// Forward SIGINT to the shell
// TODO for now this is only needed if the terminal is in raw mode, but
// when the UI is externalized we'll also need it, so leave it here
// TODO(tarruda): for now this is only needed if the terminal is in raw
// mode, but when the UI is externalized we'll also need it, so leave it
// here
uv_process_kill(&proc, SIGINT);
got_int = false;
}
@ -232,8 +233,9 @@ int os_call_shell(char_u *cmd, ShellOpts opts, char_u *extra_shell_arg)
append_ga_line(&pdata.ga);
// remember that the NL was missing
curbuf->b_no_eol_lnum = curwin->w_cursor.lnum;
} else
} else {
curbuf->b_no_eol_lnum = 0;
}
ga_clear(&pdata.ga);
}
@ -296,9 +298,9 @@ static int word_length(char_u *str)
static void write_selection(uv_write_t *req)
{
ProcessData *pdata = (ProcessData *)req->data;
// TODO use a static buffer for up to a limit(BUFFER_LENGTH) and only after
// filled we should start allocating memory(skip unnecessary allocations for
// small writes)
// TODO(tarruda): use a static buffer for up to a limit(BUFFER_LENGTH) and
// only after filled we should start allocating memory(skip unnecessary
// allocations for small writes)
int buflen = BUFFER_LENGTH;
pdata->wbuffer = (char *)xmalloc(buflen);
uv_buf_t uvbuf;
@ -356,8 +358,9 @@ static void write_selection(uv_write_t *req)
}
lp = ml_get(lnum);
written = 0;
} else if (len > 0)
} else if (len > 0) {
written += len;
}
}
uvbuf.base = pdata->wbuffer;
@ -384,8 +387,8 @@ static void alloc_cb(uv_handle_t *handle, size_t suggested, uv_buf_t *buf)
static void read_cb(uv_stream_t *stream, ssize_t cnt, const uv_buf_t *buf)
{
// TODO avoid using a growable array for this, refactor the algorithm
// to call `ml_append` directly(skip unecessary copies/resizes)
// TODO(tarruda): avoid using a growable array for this, refactor the
// algorithm to call `ml_append` directly(skip unecessary copies/resizes)
int i;
ProcessData *pdata = (ProcessData *)stream->data;
@ -429,12 +432,11 @@ static int proc_cleanup_exit(ProcessData *proc_data,
uv_process_options_t *proc_opts,
int shellopts)
{
if (proc_data->exited) {
if (!emsg_silent && proc_data->exit_status != 0 &&
!(shellopts & kShellOptSilent)) {
MSG_PUTS(_("\nshell returned "));
msg_outnum((long)proc_data->exit_status);
msg_outnum((int64_t)proc_data->exit_status);
msg_putchar('\n');
}
}

View File

@ -80,7 +80,7 @@ void signal_handle(Event event)
case SIGPWR:
// Signal of a power failure(eg batteries low), flush the swap files to
// be safe
ml_sync_all(FALSE, FALSE);
ml_sync_all(false, false);
break;
#endif
case SIGPIPE:
@ -136,7 +136,7 @@ static void deadly_signal(int signum)
// Set the v:dying variable.
set_vim_var_nr(VV_DYING, 1);
sprintf((char *)IObuff, "Vim: Caught deadly signal '%s'\n",
snprintf((char *)IObuff, sizeof(IObuff), "Vim: Caught deadly signal '%s'\n",
signal_name(signum));
// Preserve files and exit. This sets the really_exiting flag to prevent
@ -152,7 +152,7 @@ static void signal_cb(uv_signal_t *handle, int signum)
}
return;
}
}
Event event = {
.type = kEventSignal,

View File

@ -9,5 +9,5 @@ void signal_accept_deadly(void);
void signal_reject_deadly(void);
void signal_handle(Event event);
#endif
#endif // NEOVIM_OS_SIGNAL_H