Browse Source

code cleanup: combine two identical if-clauses

master
Juho Hiltunen 2 years ago
parent
commit
6362245b24
1 changed files with 6 additions and 7 deletions
  1. 6
    7
      src/libespeak-ng/compiledata.c

+ 6
- 7
src/libespeak-ng/compiledata.c View File

@@ -1204,7 +1204,6 @@ static int Hash8(const char *string)

static int LoadEnvelope2(CompileContext *ctx, FILE *f)
{
int ix, ix2;
int displ;
int n_points;
char line_buf[128];
@@ -1227,15 +1226,14 @@ static int LoadEnvelope2(CompileContext *ctx, FILE *f)
}
}
}

if (n_points > 0) {
env_x[n_points] = env_x[n_points-1];
env_y[n_points] = env_y[n_points-1];
}
env_y[n_points] = env_y[n_points-1];

ix = 0;
ix2 = 0;

if (n_points > 0) for (int x = 0; x < ENV_LEN; x++) {
int ix = 0;
int ix2 = 0;
for (int x = 0; x < ENV_LEN; x++) {
if (n_points > 3 && x > env_x[ix+3])
ix++;
if (n_points > 2 && x >= env_x[ix2+1])
@@ -1252,6 +1250,7 @@ static int LoadEnvelope2(CompileContext *ctx, FILE *f)
if (y > 255) y = 255;
env[x] = y;
}
}

displ = ftell(ctx->f_phdata);
fwrite(env, 1, ENV_LEN, ctx->f_phdata);

Loading…
Cancel
Save