Problem: The code style has to be checked manually.
Solution: Add basic code style checks in a test. Fix or avoid uncovered
problems.
// We can't simply use sizeof(UINT32_T), it would generate a compiler
// warning.
- if (ui != 0xffffffffUL || ui + 1 != 0) {
+ if (ui != 0xffffffffUL || ui + 1 != 0)
+ {
err++;
emsg(_(e_sizeof_uint32_isnot_four));
}
}
}
-#define BF_CFB_UPDATE(bfs, c) { \
+#define BF_CFB_UPDATE(bfs, c) \
+{ \
bfs->cfb_buffer[bfs->update_offset] ^= (char_u)c; \
if (++bfs->update_offset == bfs->cfb_len) \
bfs->update_offset = 0; \
}
-#define BF_RANBYTE(bfs, t) { \
+#define BF_RANBYTE(bfs, t) \
+{ \
if ((bfs->randbyte_offset & BF_BLOCK_MASK) == 0) \
bf_e_cblock(bfs, &(bfs->cfb_buffer[bfs->randbyte_offset])); \
t = bfs->cfb_buffer[bfs->randbyte_offset]; \
// It could have been something like
// case 1: if (asdf &&
- // ldfd) {
+ // condition) {
// }
if ((curbuf->b_ind_js || curbuf->b_ind_keep_case_label)
&& cin_iscase(skipwhite(ml_get_curline()), FALSE))
}
// Check if we are after an "if", "while", etc.
- // Also allow " } else".
+ // Also allow "} else".
if (cin_is_cinword(l) || cin_iselse(skipwhite(l)))
{
// Found an unterminated line after an if (), line up
{
// If we're looking at "} else", let's make sure we
// find the opening brace of the enclosing scope,
- // not the one from "if () {".
+ // not the one from "if (condition) {".
if (*l == '}')
curwin->w_cursor.col =
(colnr_T)(l - ml_get_curline()) + 1;
// line needs to be indented as a function type spec.
// Don't do this if the current line looks like a comment or if the
// current line is terminated, ie. ends in ';', or if the current line
- // contains { or }: "void f() {\n if (1)"
+ // contains { or }: "void f(condition) {\n if (1)"
if (cur_curpos.lnum < curbuf->b_ml.ml_line_count
&& !cin_nocode(theline)
&& vim_strchr(theline, '{') == NULL
/*
* Return the next byte in the pseudo-random sequence.
*/
-#define DECRYPT_BYTE_ZIP(keys, t) { \
+#define DECRYPT_BYTE_ZIP(keys, t) \
+{ \
short_u temp = (short_u)keys[2] | 2; \
t = (int)(((unsigned)(temp * (temp ^ 1U)) >> 8) & 0xff); \
}
{
if (dio->dio_internal)
{
- if (line_idx >= dout->dout_ga.ga_len) {
+ if (line_idx >= dout->dout_ga.ga_len)
break; // did last line
- }
hunk = ((diffhunk_T **)dout->dout_ga.ga_data)[line_idx++];
}
else
if (has_mbyte)
buf[(*mb_char2bytes)(code, buf)] = NUL;
- else {
+ else
+ {
buf[0] = code;
buf[1] = NUL;
}
{
mark_adjust_nofold(line2 + 1, dest, -num_lines, 0L);
#ifdef FEAT_FOLDING
- FOR_ALL_TAB_WINDOWS(tp, win) {
+ FOR_ALL_TAB_WINDOWS(tp, win)
+ {
if (win->w_buffer == curbuf)
foldMoveRange(&win->w_folds, line1, line2, dest);
}
{
mark_adjust_nofold(dest + 1, line1 - 1, num_lines, 0L);
#ifdef FEAT_FOLDING
- FOR_ALL_TAB_WINDOWS(tp, win) {
+ FOR_ALL_TAB_WINDOWS(tp, win)
+ {
if (win->w_buffer == curbuf)
foldMoveRange(&win->w_folds, dest + 1, line1 - 1, line2);
}
* Not supported commands are included to avoid ambiguities.
*/
#ifdef DO_DECLARE_EXCMD
-# define EXCMD(a, b, c, d, e) {(char_u *)b, c, (long_u)(d), e}
+# define EXCMD(a, b, c, d, e) \
+ {(char_u *)b, c, (long_u)(d), e}
typedef void (*ex_func_T) (exarg_T *eap);
XtTranslateKeycode(gui.dpy, event->xkey.keycode,
event->xkey.state, &modifier, &keysym);
- if ((keysym == XK_Shift_L) || (keysym == XK_Shift_R)) {
+ if ((keysym == XK_Shift_L) || (keysym == XK_Shift_R))
+ {
beval->showState = ShS_UPDATE_PENDING;
(*beval->msgCB)(beval, 0);
}
Dimension width, height;
tab_scroll_w = XtNameToWidget(tabLine, scroller_name);
- if (tab_scroll_w != (Widget)0) {
+ if (tab_scroll_w != (Widget)0)
+ {
XtVaGetValues(tab_scroll_w, XmNx, &pos_x, XmNy, &pos_y, XmNwidth,
&width, XmNheight, &height, NULL);
- if (pos_x >= 0) {
+ if (pos_x >= 0)
+ {
// Tab scroller (next) is visible
- if ((event->x >= pos_x) && (event->x <= pos_x + width) &&
- (event->y >= pos_y) && (event->y <= pos_y + height)) {
+ if (event->x >= pos_x && event->x <= pos_x + width
+ && event->y >= pos_y && event->y <= pos_y + height)
// Clicked on the scroller
return TRUE;
- }
}
}
return FALSE;
PhWindowEvent_t *we = info->cbdata;
ushort_t *width, *height;
- switch (we->event_f) {
+ switch (we->event_f)
+ {
case Ph_WM_CLOSE:
gui_shell_closed();
break;
unsigned int mask;
if (gui.wid && XQueryPointer(gui.dpy, gui.wid, &root, &child,
- &rootx, &rooty, &winx, &winy, &mask)) {
+ &rootx, &rooty, &winx, &winy, &mask))
+ {
*x = winx;
*y = winy;
- } else {
+ }
+ else
+ {
*x = -1;
*y = -1;
}
// width height ncolors cpp [x_hot y_hot]
"12 12 4 1 0 0",
// colors
-" s iconColor1 m black c #000000",
+"# s iconColor1 m black c #000000",
". s none m none c none",
"X s topShadowColor m none c #DCDEE5",
"o s bottomShadowColor m black c #5D6069",
// pixels
-" ..",
-" XXXXXXXX ..",
-" X....... o.",
-" X....... o.",
-" X....... o.",
-" X....... o.",
-" X....... o.",
-" X....... o.",
-" X....... o.",
-" o.",
+"##########..",
+"#XXXXXXXX#..",
+"#X.......#o.",
+"#X.......#o.",
+"#X.......#o.",
+"#X.......#o.",
+"#X.......#o.",
+"#X.......#o.",
+"#X.......#o.",
+"##########o.",
"..ooooooooo.",
"............"};
return -1;
}
(void)strcpy(csinfo[i].ppath, (const char *)ppath);
- } else
+ }
+ else
csinfo[i].ppath = NULL;
if (flags != NULL)
return -1;
}
(void)strcpy(csinfo[i].flags, (const char *)flags);
- } else
+ }
+ else
csinfo[i].flags = NULL;
#if defined(UNIX)
lua_pushvalue(L, pos);
lua_tableref = luaL_ref(L, LUA_REGISTRYINDEX);
- if (lua_getmetatable(L, pos)) {
+ if (lua_getmetatable(L, pos))
+ {
lua_getfield(L, -1, LUA___CALL);
- if (lua_isfunction(L, -1)) {
+ if (lua_isfunction(L, -1))
+ {
char_u *name;
int lua_funcref = luaL_ref(L, LUA_REGISTRYINDEX);
luaV_CFuncState *state = ALLOC_CLEAR_ONE(luaV_CFuncState);
luatyp *o = NULL; \
if (obj == NULL) \
lua_pushnil(L); \
- else { \
+ else \
+ { \
luaV_getudata(L, obj); \
if (lua_isnil(L, -1)) /* not interned? */ \
{ \
{
long _idx = PyLong_AsLong(idx);
return BufferItem((BufferObject *)(self), _idx);
- } else if (PySlice_Check(idx))
+ }
+ else if (PySlice_Check(idx))
{
Py_ssize_t start, stop, step, slicelen;
return RBAsItem((BufferObject *)(self), n, val, 1,
(Py_ssize_t)((BufferObject *)(self))->buf->b_ml.ml_line_count,
NULL);
- } else if (PySlice_Check(idx))
+ }
+ else if (PySlice_Check(idx))
{
Py_ssize_t start, stop, step, slicelen;
{
long _idx = PyLong_AsLong(idx);
return RangeItem((RangeObject *)(self), _idx);
- } else if (PySlice_Check(idx))
+ }
+ else if (PySlice_Check(idx))
{
Py_ssize_t start, stop, step, slicelen;
/*
* Functions to check the current CTRL-X mode.
*/
-int ctrl_x_mode_none(void) { return ctrl_x_mode == 0; }
-int ctrl_x_mode_normal(void) { return ctrl_x_mode == CTRL_X_NORMAL; }
-int ctrl_x_mode_scroll(void) { return ctrl_x_mode == CTRL_X_SCROLL; }
-int ctrl_x_mode_whole_line(void) { return ctrl_x_mode == CTRL_X_WHOLE_LINE; }
-int ctrl_x_mode_files(void) { return ctrl_x_mode == CTRL_X_FILES; }
-int ctrl_x_mode_tags(void) { return ctrl_x_mode == CTRL_X_TAGS; }
-int ctrl_x_mode_path_patterns(void) {
- return ctrl_x_mode == CTRL_X_PATH_PATTERNS; }
-int ctrl_x_mode_path_defines(void) {
- return ctrl_x_mode == CTRL_X_PATH_DEFINES; }
-int ctrl_x_mode_dictionary(void) { return ctrl_x_mode == CTRL_X_DICTIONARY; }
-int ctrl_x_mode_thesaurus(void) { return ctrl_x_mode == CTRL_X_THESAURUS; }
-int ctrl_x_mode_cmdline(void) {
- return ctrl_x_mode == CTRL_X_CMDLINE
+int ctrl_x_mode_none(void)
+ { return ctrl_x_mode == 0; }
+int ctrl_x_mode_normal(void)
+ { return ctrl_x_mode == CTRL_X_NORMAL; }
+int ctrl_x_mode_scroll(void)
+ { return ctrl_x_mode == CTRL_X_SCROLL; }
+int ctrl_x_mode_whole_line(void)
+ { return ctrl_x_mode == CTRL_X_WHOLE_LINE; }
+int ctrl_x_mode_files(void)
+ { return ctrl_x_mode == CTRL_X_FILES; }
+int ctrl_x_mode_tags(void)
+ { return ctrl_x_mode == CTRL_X_TAGS; }
+int ctrl_x_mode_path_patterns(void)
+ { return ctrl_x_mode == CTRL_X_PATH_PATTERNS; }
+int ctrl_x_mode_path_defines(void)
+ { return ctrl_x_mode == CTRL_X_PATH_DEFINES; }
+int ctrl_x_mode_dictionary(void)
+ { return ctrl_x_mode == CTRL_X_DICTIONARY; }
+int ctrl_x_mode_thesaurus(void)
+ { return ctrl_x_mode == CTRL_X_THESAURUS; }
+int ctrl_x_mode_cmdline(void)
+ { return ctrl_x_mode == CTRL_X_CMDLINE
|| ctrl_x_mode == CTRL_X_CMDLINE_CTRL_X; }
-int ctrl_x_mode_function(void) { return ctrl_x_mode == CTRL_X_FUNCTION; }
-int ctrl_x_mode_omni(void) { return ctrl_x_mode == CTRL_X_OMNI; }
-int ctrl_x_mode_spell(void) { return ctrl_x_mode == CTRL_X_SPELL; }
-static int ctrl_x_mode_eval(void) { return ctrl_x_mode == CTRL_X_EVAL; }
-int ctrl_x_mode_line_or_eval(void) {
- return ctrl_x_mode == CTRL_X_WHOLE_LINE || ctrl_x_mode == CTRL_X_EVAL; }
+int ctrl_x_mode_function(void)
+ { return ctrl_x_mode == CTRL_X_FUNCTION; }
+int ctrl_x_mode_omni(void)
+ { return ctrl_x_mode == CTRL_X_OMNI; }
+int ctrl_x_mode_spell(void)
+ { return ctrl_x_mode == CTRL_X_SPELL; }
+static int ctrl_x_mode_eval(void)
+ { return ctrl_x_mode == CTRL_X_EVAL; }
+int ctrl_x_mode_line_or_eval(void)
+ { return ctrl_x_mode == CTRL_X_WHOLE_LINE || ctrl_x_mode == CTRL_X_EVAL; }
/*
* Whether other than default completion has been selected.
# ifdef MSWIN
# ifndef isnan
# define isnan(x) _isnan(x)
- static __inline int isinf(double x) { return !_finite(x) && !_isnan(x); }
+ static __inline int isinf(double x)
+ { return !_finite(x) && !_isnan(x); }
# endif
# else
# ifndef HAVE_ISNAN
- static inline int isnan(double x) { return x != x; }
+ static inline int isnan(double x)
+ { return x != x; }
# endif
# ifndef HAVE_ISINF
- static inline int isinf(double x) { return !isnan(x) && isnan(x - x); }
+ static inline int isinf(double x)
+ { return !isnan(x) && isnan(x - x); }
# endif
# endif
# if !defined(INFINITY)
*/
#define VIM_CLEAR(p) \
do { \
- if ((p) != NULL) { \
+ if ((p) != NULL) \
+ { \
vim_free(p); \
(p) = NULL; \
} \
#endif
// for debugging purposes only
- if (wait_flags & WT_ENV && wait_var && getenv(wait_var) != NULL) {
+ if (wait_flags & WT_ENV && wait_var && getenv(wait_var) != NULL)
+ {
sleep(atoi(getenv(wait_var)));
- } else if (wait_flags & WT_WAIT && lookup("~/.gvimwait")) {
+ }
+ else if (wait_flags & WT_WAIT && lookup("~/.gvimwait"))
+ {
sleep(wait_secs > 0 && wait_secs < 120 ? wait_secs : 20);
- } else if (wait_flags & WT_STOP && lookup("~/.gvimstop")) {
+ }
+ else if (wait_flags & WT_STOP && lookup("~/.gvimstop"))
+ {
int w = 1;
- while (w) {
+ while (w)
+ {
;
}
}
nb_debug = fopen(file, "a");
time(&now);
fprintf(nb_debug, "%s", get_ctime(now, TRUE));
- if (level_var && (cp = getenv(level_var)) != NULL) {
+ if (level_var && (cp = getenv(level_var)) != NULL)
+ {
nb_dlevel = strtoul(cp, NULL, 0);
- } else {
+ }
+ else
+ {
nb_dlevel = NB_TRACE; // default level
}
#ifdef USE_NB_ERRORHANDLER
{
va_list ap;
- if (nb_debug != NULL && nb_dlevel & NB_TRACE) {
+ if (nb_debug != NULL && nb_dlevel & NB_TRACE)
+ {
va_start(ap, fmt);
vfprintf(nb_debug, fmt, ap);
va_end(ap);
"XRequest", buf, "Unknown", msg, sizeof(msg));
nbdbg("\tMajor opcode of failed request: %d (%s)\n",
err->request_code, msg);
- if (err->request_code > 128) {
+ if (err->request_code > 128)
+ {
nbdbg("\tMinor opcode of failed request: %d\n",
err->minor_code);
}
# ifndef ASSERT
# define ASSERT(c) \
- if (!(c)) { \
+ if (!(c)) \
+ { \
fprintf(stderr, "Assertion failed: line %d, file %s\n", \
__LINE__, __FILE__); \
fflush(stderr); \
/*
* Used when building Vim.
*/
-# define NVCMD(a, b, c, d) {a, b, c, d}
+# define NVCMD(a, b, c, d) \
+ {a, b, c, d}
#ifdef FEAT_GUI
#define NV_VER_SCROLLBAR nv_ver_scrollbar
{(char_u *)TRUE, (char_u *)0L} SCTX_INIT},
// terminal output codes
-#define p_term(sss, vvv) {sss, NULL, P_STRING|P_VI_DEF|P_RALL|P_SECURE, \
+#define p_term(sss, vvv) \
+ {sss, NULL, P_STRING|P_VI_DEF|P_RALL|P_SECURE, \
(char_u *)&vvv, PV_NONE, \
{(char_u *)"", (char_u *)0L} SCTX_INIT},
// Allocate space for a packet, make it public and clear it
packet = (struct StandardPacket *)
AllocMem((long) sizeof(struct StandardPacket), MEMF_PUBLIC | MEMF_CLEAR);
- if (!packet) {
+ if (!packet)
+ {
DeletePort(replyport);
return (0);
}
// Determine output buffer size
CFStringGetBytes(cfstr, convertRange, to, NULL, FALSE, NULL, 0, (CFIndex *)&buflen);
retval = (buflen > 0) ? alloc(buflen) : NULL;
- if (retval == NULL) {
+ if (retval == NULL)
+ {
CFRelease(cfstr);
return NULL;
}
utf8_str = CFStringCreateWithBytes(NULL, from, fromLen,
kCFStringEncodingUTF8, FALSE);
- if (utf8_str == NULL) {
+ if (utf8_str == NULL)
+ {
if (actualLen)
*actualLen = 0;
return NULL;
if ( tmode == TMODE_RAW )
set_tty(0, 0);
- else{
+ else
+ {
switch (orgmode.width)
{
case 132: OUT_STR_NF((char_u *)"\033[?3h\033>"); break;
return 1;
// accept all DECC$K_FILE and DECC$K_DIRECTORY
- if (vms_match_num == 0) {
+ if (vms_match_num == 0)
+ {
// first time through, setup some things
- if (NULL == vms_fmatch) {
+ if (NULL == vms_fmatch)
+ {
vms_fmatch = ALLOC_MULT(char_u *, EXPL_ALLOC_INC);
if (!vms_fmatch)
return 0;
vms_match_alloced = EXPL_ALLOC_INC;
vms_match_free = EXPL_ALLOC_INC;
}
- else {
+ else
+ {
// re-use existing space
vms_match_free = vms_match_alloced;
}
name=vms_tolower(name);
// if name already exists, don't add it
- for (i = 0; i<vms_match_num; i++) {
+ for (i = 0; i<vms_match_num; i++)
+ {
if (0 == STRCMP((char_u *)name,vms_fmatch[i]))
return 1;
}
- if (--vms_match_free == 0) {
+ if (--vms_match_free == 0)
+ {
char_u **old_vms_fmatch = vms_fmatch;
// add more space to store matches
vms_match_num = 0; // reset collection counter
result = decc$translate_vms(vms_fixfilename(buf));
- if ( (int) result == 0 || (int) result == -1 ) {
+ if ( (int) result == 0 || (int) result == -1 )
+ {
cnt = 0;
- } else {
+ }
+ else
+ {
cnt = decc$to_vms(result, vms_wproc, 1 /*allow wild*/ , (flags & EW_DIR ? 0:1 ) /*allow directory*/) ;
}
if (cnt > 0)
// the result from the decc$translate_vms needs to be handled
// otherwise it might create ACCVIO error in decc$to_vms
result = decc$translate_vms(vms_fixfilename(path));
- if ( (int) result == 0 || (int) result == -1 ) {
+ if ( (int) result == 0 || (int) result == -1 )
+ {
cnt = 0;
- } else {
+ }
+ else
+ {
cnt = decc$to_vms(result, vms_wproc, 1 /*allow_wild*/, (flags & EW_DIR ? 0:1 ) /*allow directory*/);
}
if (cnt > 0)
// copy vms filename portion up to last colon
// (node and/or disk)
lastcolon = strrchr(in, ':'); // find last colon
- if (lastcolon != NULL) {
+ if (lastcolon != NULL)
+ {
len = lastcolon - in + 1;
strncpy(out, in, len);
out += len;
// start of directory portion
ch = *in;
- if ((ch == '[') || (ch == '/') || (ch == '<')) { // start of directory(s) ?
+ if ((ch == '[') || (ch == '/') || (ch == '<')) // start of directory(s) ?
+ {
ch = '[';
SKIP_FOLLOWING_SLASHES(in);
- } else if (EQN(in, "../", 3)) { // Unix parent directory?
+ }
+ else if (EQN(in, "../", 3)) // Unix parent directory?
+ {
*out++ = '[';
*out++ = '-';
end_of_dir = out;
ch = '.';
in += 2;
SKIP_FOLLOWING_SLASHES(in);
- } else { // not a special character
- while (EQN(in, "./", 2)) { // Ignore Unix "current dir"
+ }
+ else
+ { // not a special character
+ while (EQN(in, "./", 2)) // Ignore Unix "current dir"
+ {
in += 2;
SKIP_FOLLOWING_SLASHES(in);
}
- if (strchr(in, '/') == NULL) { // any more Unix directories ?
+ if (strchr(in, '/') == NULL) // any more Unix directories ?
+ {
strcpy(out, in); // No - get rest of the spec
return;
- } else {
+ }
+ else
+ {
*out++ = '['; // Yes, denote a Vms subdirectory
ch = '.';
--in;
*out++ = ch;
++in;
- while (*in != '\0') {
+ while (*in != '\0')
+ {
ch = *in;
- if ((ch == ']') || (ch == '/') || (ch == '>') ) { // end of (sub)directory ?
+ if ((ch == ']') || (ch == '/') || (ch == '>') ) // end of (sub)directory ?
+ {
end_of_dir = out;
ch = '.';
SKIP_FOLLOWING_SLASHES(in);
}
- else if (EQN(in, "../", 3)) { // Unix parent directory?
+ else if (EQN(in, "../", 3)) // Unix parent directory?
+ {
*out++ = '-';
end_of_dir = out;
ch = '.';
in += 2;
SKIP_FOLLOWING_SLASHES(in);
}
- else {
- while (EQN(in, "./", 2)) { // Ignore Unix "current dir"
- end_of_dir = out;
- in += 2;
- SKIP_FOLLOWING_SLASHES(in);
- ch = *in;
+ else
+ {
+ while (EQN(in, "./", 2)) // Ignore Unix "current dir"
+ {
+ end_of_dir = out;
+ in += 2;
+ SKIP_FOLLOWING_SLASHES(in);
+ ch = *in;
}
}
*cp = '\0';
else if ((cp = vim_strrchr( fname, '.')) != NULL )
{
- if ((fp = vim_strrchr( fname, ']')) != NULL ) {;}
- else if ((fp = vim_strrchr( fname, '>')) != NULL ) {;}
- else fp = fname;
+ if ((fp = vim_strrchr( fname, ']')) != NULL )
+ {;}
+ else if ((fp = vim_strrchr( fname, '>')) != NULL )
+ {;}
+ else
+ fp = fname;
while ( *fp != '\0' && fp < cp )
if ( *fp++ == '.' )
if (!iochan)
get_tty();
- if (sec > 0) {
+ if (sec > 0)
+ {
// time-out specified; convert it to absolute time
// sec>0 requirement of lib$cvtf_to_internal_time()
return 0; // error
}
- while (TRUE) {
+ while (TRUE)
+ {
// select()
status = sys$qiow(0, iochan, IO$_SENSEMODE | IO$M_TYPEAHDCNT, iosb,
0, 0, &typeahead, 8, 0, 0, 0, 0);
return 1; // ready to read
// there's nothing to read; what now?
- if (msec == 0) {
+ if (msec == 0)
+ {
// immediate time-out; return impatiently
return 0;
- } else if (msec < 0) {
+ }
+ else if (msec < 0)
+ {
// no time-out; wait on indefinitely
return 1; // fakeout to force a wait in vms_read()
- } else {
+ }
+ else
+ {
// time-out needs to be checked
status = sys$gettim(&time_curr);
if (status != SS$_NORMAL)
{'m', ".\\+"}, // 7
#define FMT_PATTERN_R 8
{'r', ".*"}, // 8
- {'p', "[- .]*"}, // 9
+ {'p', "[- .]*"}, // 9
{'v', "\\d\\+"}, // 10
{'s', ".\\+"}, // 11
{'o', ".\\+"} // 12
if (qfp->qf_module != NULL && *qfp->qf_module != NUL)
vim_snprintf((char *)IObuff, IOSIZE, "%2d %s", qf_idx,
(char *)qfp->qf_module);
- else {
+ else
+ {
if (qfp->qf_fnum != 0
&& (buf = buflist_findnr(qfp->qf_fnum)) != NULL)
{
REG_MULTI ? save_se_multi((savep), (posp)) : save_se_one((savep), (pp))
// After a failed match restore the sub-expressions.
-#define restore_se(savep, posp, pp) { \
+#define restore_se(savep, posp, pp) \
+{ \
if (REG_MULTI) \
*(posp) = (savep)->se_u.pos; \
else \
- *(pp) = (savep)->se_u.ptr; }
+ *(pp) = (savep)->se_u.ptr; \
+}
/*
* Tentatively set the sub-expression start to the current position (after
goto theend;
}
-#define ADD_STATE_IF_MATCH(state) \
- if (result) { \
- add_state = state->out; \
- add_off = clen; \
+#define ADD_STATE_IF_MATCH(state) \
+ if (result) \
+ { \
+ add_state = state->out; \
+ add_off = clen; \
}
/*
add_to_history(HIST_SEARCH, pat, TRUE, NUL);
if (used_pat)
- *used_pat = pat;
+ *used_pat = pat;
vim_free(mr_pattern);
#ifdef FEAT_RIGHTLEFT
* (actually, we skip #\( et al)
*/
if (curbuf->b_p_lisp
- && vim_strchr((char_u *)"(){}[]", c) != NULL
+ && vim_strchr((char_u *)"{}()[]", c) != NULL
&& pos.col > 1
&& check_prevcol(linep, pos.col, '\\', NULL)
&& check_prevcol(linep, pos.col - 1, '#', NULL))
if (!*tmp)
break;
- if (_match(id, tmp) == len) {
+ if (_match(id, tmp) == len)
+ {
tmp += len; // find '=' '@' or '#'
if (*tmp == '@') // :xx@: entry for tc
return 0; // deleted entry
hold= *buf;
- while (*++tmp && *tmp != ':') { // not at end of field
- switch(*tmp) {
+ while (*++tmp && *tmp != ':') // not at end of field
+ {
+ switch(*tmp)
+ {
case '\\': // Expand escapes here
- switch(*++tmp) {
+ switch(*++tmp)
+ {
case 0: // ignore backslashes
tmp--; // at end of entry
break; // shouldn't happen
bufp = buffer;
ptr = cm;
- while (*ptr) {
- if ((c = *ptr++) != '%') { // normal char
+ while (*ptr)
+ {
+ if ((c = *ptr++) != '%') // normal char
+ {
*bufp++ = c;
- } else { // % escape
- switch(c = *ptr++) {
+ }
+ else
+ { // % escape
+ switch(c = *ptr++)
+ {
case 'd': // decimal
bufp = _addfmt(bufp, "%d", line);
line = col;
if (line == '\t' || // these are
line == '\n' || // chars that
line == '\004' || // UNIX hates
- line == '\0') {
+ line == '\0')
+ {
line++; // so go to next pos
if (reverse == (line == col))
addup=1; // and mark UP
}
if (addup) // add upline
- if (UP) {
+ if (UP)
+ {
ptr=UP;
while (VIM_ISDIGIT(*ptr) || *ptr == '.')
ptr++;
}
if (addbak) // add backspace
- if (BC) {
+ if (BC)
+ {
ptr=BC;
while (VIM_ISDIGIT(*ptr) || *ptr == '.')
ptr++;
counter, // digits
atol(const char *);
- if (VIM_ISDIGIT(*cp)) {
+ if (VIM_ISDIGIT(*cp))
+ {
counter = 0;
frac = 1000;
while (VIM_ISDIGIT(*cp))
counter = counter * 10L + (long)(*cp++ - '0');
if (*cp == '.')
- while (VIM_ISDIGIT(*++cp)) {
+ while (VIM_ISDIGIT(*++cp))
+ {
counter = counter * 10L + (long)(*cp++ - '0');
frac = frac * 10;
}
- if (*cp!='*') { // multiply by affected lines
+ if (*cp!='*') // multiply by affected lines
+ {
if (affcnt>1) affcnt = 1;
}
else
test_cmdline \
test_cmdmods \
test_cmdwin \
+ test_codestyle \
test_command_count \
test_comments \
test_comparators \
test_cmdline.res \
test_cmdmods.res \
test_cmdwin.res \
+ test_codestyle.res \
test_command_count.res \
test_comments.res \
test_comparators.res \
--- /dev/null
+" Test for checking the source code style.
+
+def Test_source_files()
+ for fname in glob('../*.[ch]', 0, 1)
+ exe 'edit ' .. fname
+
+ cursor(1, 1)
+ var lnum = search(' \t')
+ assert_equal(0, lnum, fname .. ': space before tab')
+
+ cursor(1, 1)
+ lnum = search('\s$')
+ assert_equal(0, lnum, fname .. ': trailing white space')
+
+ # some files don't stick to the Vim style rules
+ if fname =~ 'iscygpty.c'
+ continue
+ endif
+
+ # Examples in comments use "condition) {", skip them.
+ # Skip if a double quote or digit comes after the "{".
+ # Skip specific string used in os_unix.c.
+ # Also skip fold markers.
+ var skip = 'getline(".") =~ "condition) {" || getline(".") =~ "vimglob_func" || getline(".") =~ "{\"" || getline(".") =~ "{\\d" || getline(".") =~ "{{{"'
+ cursor(1, 1)
+ lnum = search(')\s*{', '', 0, 0, skip)
+ assert_equal(0, lnum, fname .. ': curly after closing paren')
+
+ cursor(1, 1)
+ # Examples in comments use double quotes.
+ skip = "getline('.') =~ '\"'"
+ # Avoid examples that contain: "} else
+ lnum = search('[^"]}\s*else', '', 0, 0, skip)
+ assert_equal(0, lnum, fname .. ': curly before "else"')
+
+ cursor(1, 1)
+ lnum = search('else\s*{', '', 0, 0, skip)
+ assert_equal(0, lnum, fname .. ': curly after "else"')
+ endfor
+
+ bwipe!
+enddef
+
+
+" vim: shiftwidth=2 sts=2 expandtab
if (advapi_lib != NULL)
delete_key_ex = (LONG (WINAPI *)(HKEY, LPCTSTR, REGSAM, DWORD))GetProcAddress(advapi_lib, "RegDeleteKeyExA");
}
- if (delete_key_ex != NULL) {
+ if (delete_key_ex != NULL)
+ {
return (*delete_key_ex)(hRootKey, key, flag, 0);
}
return RegDeleteKey(hRootKey, key);
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1234,
/**/
1233,
/**/
# define gtk_widget_set_window(wid, win) \
do { (wid)->window = (win); } while (0)
# define gtk_widget_set_can_default(wid, can) \
- do { if (can) { GTK_WIDGET_SET_FLAGS(wid, GTK_CAN_DEFAULT); } \
- else { GTK_WIDGET_UNSET_FLAGS(wid, GTK_CAN_DEFAULT); } } while (0)
+ do { if (can) \
+ { GTK_WIDGET_SET_FLAGS(wid, GTK_CAN_DEFAULT); } \
+ else \
+ { GTK_WIDGET_UNSET_FLAGS(wid, GTK_CAN_DEFAULT); } } while (0)
# define gtk_widget_set_can_focus(wid, can) \
- do { if (can) { GTK_WIDGET_SET_FLAGS(wid, GTK_CAN_FOCUS); } \
- else { GTK_WIDGET_UNSET_FLAGS(wid, GTK_CAN_FOCUS); } } while (0)
+ do { if (can) \
+ { GTK_WIDGET_SET_FLAGS(wid, GTK_CAN_FOCUS); } \
+ else \
+ { GTK_WIDGET_UNSET_FLAGS(wid, GTK_CAN_FOCUS); } } while (0)
# define gtk_widget_set_visible(wid, vis) \
- do { if (vis) { gtk_widget_show(wid); } \
- else { gtk_widget_hide(wid); } } while (0)
+ do { if (vis) \
+ { gtk_widget_show(wid); } \
+ else \
+ { gtk_widget_hide(wid); } } while (0)
# endif
# if !GTK_CHECK_VERSION(2,20,0)
# define gtk_widget_get_mapped(wid) GTK_WIDGET_MAPPED(wid)
# define gtk_widget_get_realized(wid) GTK_WIDGET_REALIZED(wid)
# define gtk_widget_set_mapped(wid, map) \
- do { if (map) { GTK_WIDGET_SET_FLAGS(wid, GTK_MAPPED); } \
- else { GTK_WIDGET_UNSET_FLAGS(wid, GTK_MAPPED); } } while (0)
+ do { if (map) \
+ { GTK_WIDGET_SET_FLAGS(wid, GTK_MAPPED); } \
+ else \
+ { GTK_WIDGET_UNSET_FLAGS(wid, GTK_MAPPED); } } while (0)
# define gtk_widget_set_realized(wid, rea) \
- do { if (rea) { GTK_WIDGET_SET_FLAGS(wid, GTK_REALIZED); } \
- else { GTK_WIDGET_UNSET_FLAGS(wid, GTK_REALIZED); } } while (0)
+ do { if (rea) \
+ { GTK_WIDGET_SET_FLAGS(wid, GTK_REALIZED); } \
+ else \
+ { GTK_WIDGET_UNSET_FLAGS(wid, GTK_REALIZED); } } while (0)
# endif
#endif