ref: 891af29bb4b94abf4dfe18451fdc8db169cb9bf7
parent: 55cb47750ad08a8bb9108c43c463b274793bf859
author: Sigrid Solveig Haflínudóttir <ftrvxmtrx@gmail.com>
date: Thu Nov 26 11:23:44 EST 2020
do not use anonymous struct member
--- a/9gc.c
+++ b/9gc.c
@@ -31,7 +31,7 @@
typedef struct REntry REntry;
struct C9aux {
- C9ctx;
+ C9ctx c;
int f;
int flags;
uint8_t rdbuf[Msize];
@@ -238,7 +238,8 @@
b++;
if ((s = strchr(s, '\n')) == NULL)
s = (char*)&r->read.data[r->read.size];
- *s++ = 0;
+ else
+ *s++ = 0;
if (strstr(b, "tlssrv") == NULL && (s = strchr(b, ' ')) != NULL) {
*s = 0;
close(a->f);
@@ -245,7 +246,7 @@
if ((a->f = dial(b)) < 0)
exit(1);
a->flags = 0;
- a->r = ctxchatR;
+ ctx->r = ctxchatR;
a->wroff = 0;
c9version(ctx, &tag, Msize);
if (wrsend(a) != 0)
@@ -289,11 +290,11 @@
return NULL;
c = calloc(1, sizeof(*c));
c->f = f;
- c->read = ctxread;
- c->begin = ctxbegin;
- c->end = ctxend;
- c->error = ctxerror;
- c->aux = c;
+ c->c.read = ctxread;
+ c->c.begin = ctxbegin;
+ c->c.end = ctxend;
+ c->c.error = ctxerror;
+ c->c.aux = c;
return c;
}
@@ -313,10 +314,10 @@
if (a == NULL)
return NULL;
- a->r = ctxregistryR;
- c9version((C9ctx*)a, &tag, Msize);
+ a->c.r = ctxregistryR;
+ c9version(&a->c, &tag, Msize);
wrsend(a);
- while (c9proc((C9ctx*)a) == 0 && a->r == ctxregistryR)
+ while (c9proc(&a->c) == 0 && a->c.r == ctxregistryR)
wrsend(a);
return a;
@@ -350,7 +351,7 @@
break;
}
- ctx = (C9ctx*)a;
+ ctx = &a->c;
if (FD_ISSET(a->f, &r)) {
c9proc(ctx);
} else if (FD_ISSET(0, &r)) {