forked from github/server
CID 22497 Missing break in switch
make this code easier to read, favor if over switch
This commit is contained in:
parent
65f1574312
commit
10f2dd2d6e
1 changed files with 6 additions and 6 deletions
|
@ -361,10 +361,10 @@ static int cr_race(variant var, char *buffer, const void *userdata)
|
||||||
static int cr_alliance(variant var, char *buffer, const void *userdata)
|
static int cr_alliance(variant var, char *buffer, const void *userdata)
|
||||||
{
|
{
|
||||||
const alliance *al = (const alliance *)var.v;
|
const alliance *al = (const alliance *)var.v;
|
||||||
|
unused_arg(userdata);
|
||||||
if (al != NULL) {
|
if (al != NULL) {
|
||||||
sprintf(buffer, "%d", al->id);
|
sprintf(buffer, "%d", al->id);
|
||||||
}
|
}
|
||||||
unused_arg(userdata);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -372,6 +372,7 @@ static int cr_skill(variant var, char *buffer, const void *userdata)
|
||||||
{
|
{
|
||||||
const faction *report = (const faction *)userdata;
|
const faction *report = (const faction *)userdata;
|
||||||
skill_t sk = (skill_t)var.i;
|
skill_t sk = (skill_t)var.i;
|
||||||
|
unused_arg(userdata);
|
||||||
if (sk != NOSKILL)
|
if (sk != NOSKILL)
|
||||||
sprintf(buffer, "\"%s\"",
|
sprintf(buffer, "\"%s\"",
|
||||||
translate(mkname("skill", skillnames[sk]), skillname(sk,
|
translate(mkname("skill", skillnames[sk]), skillname(sk,
|
||||||
|
@ -384,6 +385,7 @@ static int cr_skill(variant var, char *buffer, const void *userdata)
|
||||||
static int cr_order(variant var, char *buffer, const void *userdata)
|
static int cr_order(variant var, char *buffer, const void *userdata)
|
||||||
{
|
{
|
||||||
order *ord = (order *)var.v;
|
order *ord = (order *)var.v;
|
||||||
|
unused_arg(userdata);
|
||||||
if (ord != NULL) {
|
if (ord != NULL) {
|
||||||
char cmd[ORDERSIZE];
|
char cmd[ORDERSIZE];
|
||||||
char *wp = buffer;
|
char *wp = buffer;
|
||||||
|
@ -393,13 +395,11 @@ static int cr_order(variant var, char *buffer, const void *userdata)
|
||||||
|
|
||||||
*wp++ = '\"';
|
*wp++ = '\"';
|
||||||
for (rp = cmd; *rp;) {
|
for (rp = cmd; *rp;) {
|
||||||
switch (*rp) {
|
char r = *rp++;
|
||||||
case '\"':
|
if (r == '\"' || r == '\\') {
|
||||||
case '\\':
|
|
||||||
*wp++ = '\\';
|
*wp++ = '\\';
|
||||||
default:
|
|
||||||
*wp++ = *rp++;
|
|
||||||
}
|
}
|
||||||
|
*wp++ = r;
|
||||||
}
|
}
|
||||||
*wp++ = '\"';
|
*wp++ = '\"';
|
||||||
*wp++ = 0;
|
*wp++ = 0;
|
||||||
|
|
Loading…
Reference in a new issue