Unified · Split
| @@ -31,7 +31,7 @@ typedef struct C9aux C9aux; · 30 unmodified lines | ||
| 31 | 31 | typedef struct REntry REntry; |
| 32 | 32 | |
| 33 | 33 | struct C9aux { |
| 34 | − C9ctx; | |
| 34 | + C9ctx c; | |
| 35 | 35 | int f; |
| 36 | 36 | int flags; |
| 37 | 37 | uint8_t rdbuf[Msize]; |
| @@ -238,14 +238,15 @@ ctxregistryR(C9ctx *ctx, C9r *r) · 200 unmodified lines | ||
| 238 | 238 | b++; |
| 239 | 239 | if ((s = strchr(s, '\n')) == NULL) |
| 240 | 240 | s = (char*)&r->read.data[r->read.size]; |
| 241 | − *s++ = 0; | |
| 241 | + else | |
| 242 | + *s++ = 0; | |
| 242 | 243 | if (strstr(b, "tlssrv") == NULL && (s = strchr(b, ' ')) != NULL) { |
| 243 | 244 | *s = 0; |
| 244 | 245 | close(a->f); |
| 245 | 246 | if ((a->f = dial(b)) < 0) |
| 246 | 247 | exit(1); |
| 247 | 248 | a->flags = 0; |
| 248 | − a->r = ctxchatR; | |
| 249 | + ctx->r = ctxchatR; | |
| 249 | 250 | a->wroff = 0; |
| 250 | 251 | c9version(ctx, &tag, Msize); |
| 251 | 252 | if (wrsend(a) != 0) |
| @@ -289,11 +290,11 @@ srv(char *s) · 37 unmodified lines | ||
| 289 | 290 | return NULL; |
| 290 | 291 | c = calloc(1, sizeof(*c)); |
| 291 | 292 | c->f = f; |
| 292 | − c->read = ctxread; | |
| 293 | − c->begin = ctxbegin; | |
| 294 | − c->end = ctxend; | |
| 295 | − c->error = ctxerror; | |
| 296 | − c->aux = c; | |
| 293 | + c->c.read = ctxread; | |
| 294 | + c->c.begin = ctxbegin; | |
| 295 | + c->c.end = ctxend; | |
| 296 | + c->c.error = ctxerror; | |
| 297 | + c->c.aux = c; | |
| 297 | 298 | |
| 298 | 299 | return c; |
| 299 | 300 | } |
| @@ -313,10 +314,10 @@ registry(void) · 13 unmodified lines | ||
| 313 | 314 | if (a == NULL) |
| 314 | 315 | return NULL; |
| 315 | 316 | |
| 316 | − a->r = ctxregistryR; | |
| 317 | − c9version((C9ctx*)a, &tag, Msize); | |
| 317 | + a->c.r = ctxregistryR; | |
| 318 | + c9version(&a->c, &tag, Msize); | |
| 318 | 319 | wrsend(a); |
| 319 | − while (c9proc((C9ctx*)a) == 0 && a->r == ctxregistryR) | |
| 320 | + while (c9proc(&a->c) == 0 && a->c.r == ctxregistryR) | |
| 320 | 321 | wrsend(a); |
| 321 | 322 | |
| 322 | 323 | return a; |
| @@ -350,7 +351,7 @@ chatrw(C9aux *a) · 27 unmodified lines | ||
| 350 | 351 | break; |
| 351 | 352 | } |
| 352 | 353 | |
| 353 | − ctx = (C9ctx*)a; | |
| 354 | + ctx = &a->c; | |
| 354 | 355 | if (FD_ISSET(a->f, &r)) { |
| 355 | 356 | c9proc(ctx); |
| 356 | 357 | } else if (FD_ISSET(0, &r)) { |