mirror of
https://github.com/neovim/neovim.git
synced 2025-10-16 14:56:08 +00:00
test: format C test files and fix clang-tidy warnings
It's probably not worth adding the C test files to regular formatting as they're pretty much never touched, but ensuring the files are formatted according to our standards and getting rid of warnings is a cheap one-time fix.
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdint.h>
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
# include <Windows.h>
|
# include <Windows.h>
|
||||||
# define usleep(usecs) Sleep(usecs/1000)
|
# define usleep(usecs) Sleep(usecs/1000)
|
||||||
@@ -107,7 +108,7 @@ int main(int argc, char **argv)
|
|||||||
char cmd[100];
|
char cmd[100];
|
||||||
int arg;
|
int arg;
|
||||||
|
|
||||||
while (1) {
|
while (true) {
|
||||||
fprintf(stderr, "interact $ ");
|
fprintf(stderr, "interact $ ");
|
||||||
|
|
||||||
if (fgets(input, sizeof(input), stdin) == NULL) {
|
if (fgets(input, sizeof(input), stdin) == NULL) {
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
/// Helper program to exit and keep stdout open (like "xclip -i -loops 1").
|
/// Helper program to exit and keep stdout open (like "xclip -i -loops 1").
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include <uv.h>
|
#include <uv.h>
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
|
@@ -1,8 +1,9 @@
|
|||||||
#include <string.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "nvim/event/multiqueue.h"
|
#include <string.h>
|
||||||
|
|
||||||
#include "multiqueue.h"
|
#include "multiqueue.h"
|
||||||
|
|
||||||
|
#include "nvim/event/multiqueue.h"
|
||||||
|
|
||||||
void ut_multiqueue_put(MultiQueue *self, const char *str)
|
void ut_multiqueue_put(MultiQueue *self, const char *str)
|
||||||
{
|
{
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
#include "nvim/event/multiqueue.h"
|
#include "nvim/event/multiqueue.h"
|
||||||
|
|
||||||
void ut_multiqueue_put(MultiQueue *queue, const char *str);
|
void ut_multiqueue_put(MultiQueue *self, const char *str);
|
||||||
const char *ut_multiqueue_get(MultiQueue *queue);
|
const char *ut_multiqueue_get(MultiQueue *self);
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
#include <unistd.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <sys/wait.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <sys/wait.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
kPOSIXErrnoEINTR = EINTR,
|
kPOSIXErrnoEINTR = EINTR,
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#include "vterm_test.h"
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "vterm_test.h"
|
||||||
|
|
||||||
int parser_text(const char bytes[], size_t len, void *user)
|
int parser_text(const char bytes[], size_t len, void *user)
|
||||||
{
|
{
|
||||||
FILE *f = fopen(VTERM_TEST_FILE, "a");
|
FILE *f = fopen(VTERM_TEST_FILE, "a");
|
||||||
@@ -27,7 +27,8 @@ static void printchars(const char *s, size_t len, FILE *f)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int parser_csi(const char *leader, const long args[], int argcount, const char *intermed, char command, void *user)
|
int parser_csi(const char *leader, const long args[], int argcount, const char *intermed,
|
||||||
|
char command, void *user)
|
||||||
{
|
{
|
||||||
FILE *f = fopen(VTERM_TEST_FILE, "a");
|
FILE *f = fopen(VTERM_TEST_FILE, "a");
|
||||||
fprintf(f, "csi %02x", command);
|
fprintf(f, "csi %02x", command);
|
||||||
@@ -283,11 +284,9 @@ void print_color(const VTermColor *col)
|
|||||||
FILE *f = fopen(VTERM_TEST_FILE, "a");
|
FILE *f = fopen(VTERM_TEST_FILE, "a");
|
||||||
if (VTERM_COLOR_IS_RGB(col)) {
|
if (VTERM_COLOR_IS_RGB(col)) {
|
||||||
fprintf(f, "rgb(%d,%d,%d", col->rgb.red, col->rgb.green, col->rgb.blue);
|
fprintf(f, "rgb(%d,%d,%d", col->rgb.red, col->rgb.green, col->rgb.blue);
|
||||||
}
|
} else if (VTERM_COLOR_IS_INDEXED(col)) {
|
||||||
else if (VTERM_COLOR_IS_INDEXED(col)) {
|
|
||||||
fprintf(f, "idx(%d", col->indexed.idx);
|
fprintf(f, "idx(%d", col->indexed.idx);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
fprintf(f, "invalid(%d", col->type);
|
fprintf(f, "invalid(%d", col->type);
|
||||||
}
|
}
|
||||||
if (VTERM_COLOR_IS_DEFAULT_FG(col)) {
|
if (VTERM_COLOR_IS_DEFAULT_FG(col)) {
|
||||||
@@ -322,7 +321,8 @@ int state_settermprop(VTermProp prop, VTermValue *val, void *user)
|
|||||||
goto end;
|
goto end;
|
||||||
case VTERM_VALUETYPE_STRING:
|
case VTERM_VALUETYPE_STRING:
|
||||||
fprintf(f, "settermprop %d %s\"%.*s\"%s\n", prop,
|
fprintf(f, "settermprop %d %s\"%.*s\"%s\n", prop,
|
||||||
val->string.initial ? "[" : "", (int)val->string.len, val->string.str, val->string.final ? "]" : "");
|
val->string.initial ? "[" : "", (int)val->string.len, val->string.str,
|
||||||
|
val->string.final ? "]" : "");
|
||||||
errcode = 0;
|
errcode = 0;
|
||||||
goto end;
|
goto end;
|
||||||
case VTERM_VALUETYPE_COLOR:
|
case VTERM_VALUETYPE_COLOR:
|
||||||
@@ -422,7 +422,8 @@ int state_setpenattr(VTermAttr attr, VTermValue *val, void *user)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool want_state_scrollback;
|
bool want_state_scrollback;
|
||||||
int state_sb_clear(void *user) {
|
int state_sb_clear(void *user)
|
||||||
|
{
|
||||||
if (!want_state_scrollback) {
|
if (!want_state_scrollback) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@@ -5,7 +5,8 @@
|
|||||||
#include "vterm/vterm.h"
|
#include "vterm/vterm.h"
|
||||||
|
|
||||||
int parser_text(const char bytes[], size_t len, void *user);
|
int parser_text(const char bytes[], size_t len, void *user);
|
||||||
int parser_csi(const char *leader, const long args[], int argcount, const char *intermed, char command, void *user);
|
int parser_csi(const char *leader, const long args[], int argcount, const char *intermed,
|
||||||
|
char command, void *user);
|
||||||
int parser_osc(int command, VTermStringFragment frag, void *user);
|
int parser_osc(int command, VTermStringFragment frag, void *user);
|
||||||
int parser_dcs(const char *command, size_t commandlen, VTermStringFragment frag, void *user);
|
int parser_dcs(const char *command, size_t commandlen, VTermStringFragment frag, void *user);
|
||||||
int parser_apc(VTermStringFragment frag, void *user);
|
int parser_apc(VTermStringFragment frag, void *user);
|
||||||
|
Reference in New Issue
Block a user