0
0
mirror of https://github.com/vim/vim.git synced 2025-10-09 06:14:17 -04:00

patch 8.1.2387: using old C style comments

Problem:    Using old C style comments.
Solution:   Use // comments where appropriate.
This commit is contained in:
Bram Moolenaar
2019-12-04 21:24:53 +01:00
parent 9834b96820
commit 2ab2e8608f
12 changed files with 1349 additions and 1335 deletions

View File

@@ -64,18 +64,18 @@
typedef struct PendingCommand
{
int serial; /* Serial number expected in result. */
int code; /* Result Code. 0 is OK */
char_u *result; /* String result for command (malloc'ed).
* NULL means command still pending. */
int serial; // Serial number expected in result.
int code; // Result Code. 0 is OK
char_u *result; // String result for command (malloc'ed).
// NULL means command still pending.
struct PendingCommand *nextPtr;
/* Next in list of all outstanding commands.
* NULL means end of list. */
// Next in list of all outstanding commands.
// NULL means end of list.
} PendingCommand;
static PendingCommand *pendingCommands = NULL;
/* List of all commands currently
* being waited for. */
// List of all commands currently
// being waited for.
/*
* The information below is used for communication between processes
@@ -179,7 +179,7 @@ struct x_cmdqueue
typedef struct x_cmdqueue x_queue_T;
/* dummy node, header for circular queue */
// dummy node, header for circular queue
static x_queue_T head = {NULL, 0, NULL, NULL};
/*
@@ -200,12 +200,12 @@ static int IsSerialName(char_u *name);
static void save_in_queue(char_u *buf, long_u len);
static void server_parse_message(Display *dpy, char_u *propInfo, long_u numItems);
/* Private variables for the "server" functionality */
// Private variables for the "server" functionality
static Atom registryProperty = None;
static Atom vimProperty = None;
static int got_x_error = FALSE;
static char_u *empty_prop = (char_u *)""; /* empty GetRegProp() result */
static char_u *empty_prop = (char_u *)""; // empty GetRegProp() result
/*
* Associate an ASCII name with Vim. Try real hard to get a unique one.
@@ -213,8 +213,8 @@ static char_u *empty_prop = (char_u *)""; /* empty GetRegProp() result */
*/
int
serverRegisterName(
Display *dpy, /* display to register with */
char_u *name) /* the name that will be used as a base */
Display *dpy, // display to register with
char_u *name) // the name that will be used as a base
{
int i;
int res;
@@ -329,25 +329,25 @@ DoRegisterName(Display *dpy, char_u *name)
*/
void
serverChangeRegisteredWindow(
Display *dpy, /* Display to register with */
Window newwin) /* Re-register to this ID */
Display *dpy, // Display to register with
Window newwin) // Re-register to this ID
{
char_u propInfo[MAX_NAME_LENGTH + 20];
commWindow = newwin;
/* Always call SendInit() here, to make sure commWindow is marked as a Vim
* window. */
// Always call SendInit() here, to make sure commWindow is marked as a Vim
// window.
if (SendInit(dpy) < 0)
return;
/* WARNING: Do not step through this while debugging, it will hangup the X
* server! */
// WARNING: Do not step through this while debugging, it will hangup the X
// server!
XGrabServer(dpy);
DeleteAnyLingerer(dpy, newwin);
if (serverName != NULL)
{
/* Reinsert name if we was already registered */
// Reinsert name if we was already registered
(void)LookupName(dpy, serverName, /*delete=*/TRUE, NULL);
sprintf((char *)propInfo, "%x %.*s",
(int_u)newwin, MAX_NAME_LENGTH, serverName);
@@ -365,30 +365,30 @@ serverChangeRegisteredWindow(
*/
int
serverSendToVim(
Display *dpy, /* Where to send. */
char_u *name, /* Where to send. */
char_u *cmd, /* What to send. */
char_u **result, /* Result of eval'ed expression */
Window *server, /* Actual ID of receiving app */
Bool asExpr, /* Interpret as keystrokes or expr ? */
int timeout, /* seconds to wait or zero */
Bool localLoop, /* Throw away everything but result */
int silent) /* don't complain about no server */
Display *dpy, // Where to send.
char_u *name, // Where to send.
char_u *cmd, // What to send.
char_u **result, // Result of eval'ed expression
Window *server, // Actual ID of receiving app
Bool asExpr, // Interpret as keystrokes or expr ?
int timeout, // seconds to wait or zero
Bool localLoop, // Throw away everything but result
int silent) // don't complain about no server
{
Window w;
char_u *property;
int length;
int res;
static int serial = 0; /* Running count of sent commands.
* Used to give each command a
* different serial number. */
static int serial = 0; // Running count of sent commands.
// Used to give each command a
// different serial number.
PendingCommand pending;
char_u *loosename = NULL;
if (result != NULL)
*result = NULL;
if (name == NULL || *name == NUL)
name = (char_u *)"GVIM"; /* use a default name */
name = (char_u *)"GVIM"; // use a default name
if (commProperty == None && dpy != NULL)
{
@@ -396,7 +396,7 @@ serverSendToVim(
return -1;
}
/* Execute locally if no display or target is ourselves */
// Execute locally if no display or target is ourselves
if (dpy == NULL || (serverName != NULL && STRICMP(name, serverName) == 0))
return sendToLocalVim(cmd, asExpr, result);
@@ -411,7 +411,7 @@ serverSendToVim(
while (TRUE)
{
w = LookupName(dpy, name, FALSE, &loosename);
/* Check that the window is hot */
// Check that the window is hot
if (w != None)
{
if (!WindowValid(dpy, w))
@@ -447,11 +447,11 @@ serverSendToVim(
0, asExpr ? 'c' : 'k', 0, name, 0, p_enc, 0, cmd);
if (name == loosename)
vim_free(loosename);
/* Add a back reference to our comm window */
// Add a back reference to our comm window
serial++;
sprintf((char *)property + length, "%c-r %x %d",
0, (int_u)commWindow, serial);
/* Add length of what "-r %x %d" resulted in, skipping the NUL. */
// Add length of what "-r %x %d" resulted in, skipping the NUL.
length += STRLEN(property + length + 1) + 1;
res = AppendPropCarefully(dpy, w, commProperty, property, length + 1);
@@ -462,7 +462,7 @@ serverSendToVim(
return -1;
}
if (!asExpr) /* There is no answer for this - Keys are sent async */
if (!asExpr) // There is no answer for this - Keys are sent async
return 0;
/*
@@ -592,7 +592,7 @@ ServerWait(
check_due_timer();
#endif
/* Just look out for the answer without calling back into Vim */
// Just look out for the answer without calling back into Vim
if (localLoop)
{
#ifndef HAVE_SELECT
@@ -670,9 +670,8 @@ serverGetVimNames(Display *dpy)
return ga.ga_data;
}
/* ----------------------------------------------------------
* Reply stuff
*/
/////////////////////////////////////////////////////////////
// Reply stuff
static struct ServerReply *
ServerReplyFind(Window w, enum ServerReplyOp op)
@@ -754,7 +753,7 @@ serverSendReply(char_u *name, char_u *str)
{
sprintf((char *)property, "%cn%c-E %s%c-n %s%c-w %x",
0, 0, p_enc, 0, str, 0, (unsigned int)commWindow);
/* Add length of what "%x" resulted in. */
// Add length of what "%x" resulted in.
length += STRLEN(property + length);
res = AppendPropCarefully(dpy, win, commProperty, property, length + 1);
vim_free(property);
@@ -804,7 +803,7 @@ serverReadReply(
}
else
{
/* Last string read. Remove from list */
// Last string read. Remove from list
ga_clear(&p->strings);
ServerReplyFind(win, SROP_Delete);
}
@@ -864,14 +863,14 @@ SendInit(Display *dpy)
WhitePixel(dpy, DefaultScreen(dpy)),
WhitePixel(dpy, DefaultScreen(dpy)));
XSelectInput(dpy, commWindow, PropertyChangeMask);
/* WARNING: Do not step through this while debugging, it will hangup
* the X server! */
// WARNING: Do not step through this while debugging, it will hangup
// the X server!
XGrabServer(dpy);
DeleteAnyLingerer(dpy, commWindow);
XUngrabServer(dpy);
}
/* Make window recognizable as a vim window */
// Make window recognizable as a vim window
XChangeProperty(dpy, commWindow, vimProperty, XA_STRING,
8, PropModeReplace, (char_u *)VIM_VERSION_SHORT,
(int)STRLEN(VIM_VERSION_SHORT) + 1);
@@ -896,11 +895,11 @@ SendInit(Display *dpy)
*/
static Window
LookupName(
Display *dpy, /* Display whose registry to check. */
char_u *name, /* Name of a server. */
int delete, /* If non-zero, delete info about name. */
char_u **loose) /* Do another search matching -999 if not found
Return result here if a match is found */
Display *dpy, // Display whose registry to check.
char_u *name, // Name of a server.
int delete, // If non-zero, delete info about name.
char_u **loose) // Do another search matching -999 if not found
// Return result here if a match is found
{
char_u *regProp, *entry;
char_u *p;
@@ -917,7 +916,7 @@ LookupName(
* Scan the property for the desired name.
*/
returnValue = (int_u)None;
entry = NULL; /* Not needed, but eliminates compiler warning. */
entry = NULL; // Not needed, but eliminates compiler warning.
for (p = regProp; (long_u)(p - regProp) < numItems; )
{
entry = p;
@@ -990,8 +989,8 @@ LookupName(
*/
static void
DeleteAnyLingerer(
Display *dpy, /* Display whose registry to check. */
Window win) /* Window to remove */
Display *dpy, // Display whose registry to check.
Window win) // Window to remove
{
char_u *regProp, *entry = NULL;
char_u *p;
@@ -1004,7 +1003,7 @@ DeleteAnyLingerer(
if (GetRegProp(dpy, &regProp, &numItems, FALSE) == FAIL)
return;
/* Scan the property for the window id. */
// Scan the property for the window id.
for (p = regProp; (long_u)(p - regProp) < numItems; )
{
if (*p != 0)
@@ -1014,7 +1013,7 @@ DeleteAnyLingerer(
{
int lastHalf;
/* Copy down the remainder to delete entry */
// Copy down the remainder to delete entry
entry = p;
while (*p != 0)
p++;
@@ -1055,7 +1054,7 @@ GetRegProp(
Display *dpy,
char_u **regPropp,
long_u *numItemsp,
int domsg) /* When TRUE give error message. */
int domsg) // When TRUE give error message.
{
int result, actualFormat;
long_u bytesAfter;
@@ -1079,13 +1078,13 @@ GetRegProp(
if (actualType == None)
{
/* No prop yet. Logically equal to the empty list */
// No prop yet. Logically equal to the empty list
*numItemsp = 0;
*regPropp = empty_prop;
return OK;
}
/* If the property is improperly formed, then delete it. */
// If the property is improperly formed, then delete it.
if (result != Success || actualFormat != 8 || actualType != XA_STRING)
{
if (*regPropp != NULL)
@@ -1110,8 +1109,8 @@ GetRegProp(
void
serverEventProc(
Display *dpy,
XEvent *eventPtr, /* Information about event. */
int immediate) /* Run event immediately. Should mostly be 0. */
XEvent *eventPtr, // Information about event.
int immediate) // Run event immediately. Should mostly be 0.
{
char_u *propInfo;
int result, actualFormat;
@@ -1135,7 +1134,7 @@ serverEventProc(
&actualFormat, &numItems, &bytesAfter,
&propInfo);
/* If the property doesn't exist or is improperly formed then ignore it. */
// If the property doesn't exist or is improperly formed then ignore it.
if (result != Success || actualType != XA_STRING || actualFormat != 8)
{
if (propInfo != NULL)
@@ -1159,17 +1158,17 @@ save_in_queue(char_u *propInfo, long_u len)
node = ALLOC_ONE(x_queue_T);
if (node == NULL)
return; /* out of memory */
return; // out of memory
node->propInfo = propInfo;
node->len = len;
if (head.next == NULL) /* initialize circular queue */
if (head.next == NULL) // initialize circular queue
{
head.next = &head;
head.prev = &head;
}
/* insert node at tail of queue */
// insert node at tail of queue
node->next = &head;
node->prev = head.prev;
head.prev->next = node;
@@ -1185,7 +1184,7 @@ server_parse_messages(void)
x_queue_T *node;
if (!X_DISPLAY)
return; /* cannot happen? */
return; // cannot happen?
while (head.next != NULL && head.next != &head)
{
node = head.next;
@@ -1214,8 +1213,8 @@ server_waiting(void)
static void
server_parse_message(
Display *dpy,
char_u *propInfo, /* A string containing 0 or more X commands */
long_u numItems) /* The size of propInfo in bytes. */
char_u *propInfo, // A string containing 0 or more X commands
long_u numItems) // The size of propInfo in bytes.
{
char_u *p;
int code;
@@ -1276,7 +1275,7 @@ server_parse_message(
else
{
p = serial = end + 1;
clientWindow = resWindow; /* Remember in global */
clientWindow = resWindow; // Remember in global
}
break;
case 'n':
@@ -1314,14 +1313,14 @@ server_parse_message(
{
garray_T reply;
/* Initialize the result property. */
// Initialize the result property.
ga_init2(&reply, 1, 100);
(void)ga_grow(&reply, 50 + STRLEN(p_enc));
sprintf(reply.ga_data, "%cr%c-E %s%c-s %s%c-r ",
0, 0, p_enc, 0, serial, 0);
reply.ga_len = 14 + STRLEN(p_enc) + STRLEN(serial);
/* Evaluate the expression and return the result. */
// Evaluate the expression and return the result.
if (res != NULL)
ga_concat(&reply, res);
else
@@ -1485,11 +1484,11 @@ server_parse_message(
*/
static int
AppendPropCarefully(
Display *dpy, /* Display on which to operate. */
Window window, /* Window whose property is to be modified. */
Atom property, /* Name of property. */
char_u *value, /* Characters to append to property. */
int length) /* How much to append */
Display *dpy, // Display on which to operate.
Window window, // Window whose property is to be modified.
Atom property, // Name of property.
char_u *value, // Characters to append to property.
int length) // How much to append
{
XErrorHandler old_handler;
@@ -1524,4 +1523,4 @@ IsSerialName(char_u *str)
return (len > 1 && vim_isdigit(str[len - 1]));
}
#endif /* FEAT_CLIENTSERVER */
#endif // FEAT_CLIENTSERVER