Lines Matching refs:ctx
27 struct ifnameindexctx *ctx = pctx;
52 i = ctx->hash[bucket];
54 map = &ctx->list[i-1];
62 if (ctx->num >= ctx->allocated) {
63 size_t a = ctx->allocated ? ctx->allocated * 2 + 1 : 8;
65 map = realloc(ctx->list, a * sizeof *map);
67 ctx->list = map;
68 ctx->allocated = a;
70 map = &ctx->list[ctx->num];
74 ctx->str_bytes += namelen + 1;
75 ctx->num++;
76 map->hash_next = ctx->hash[bucket];
77 ctx->hash[bucket] = ctx->num;
85 struct ifnameindexctx _ctx, *ctx = &_ctx;
93 memset(ctx, 0, sizeof(*ctx));
94 if (__rtnetlink_enumerate(AF_UNSPEC, AF_INET, netlink_msg_to_nameindex, ctx) < 0) goto err;
96 ifs = malloc(sizeof(struct if_nameindex[ctx->num+1]) + ctx->str_bytes);
99 p = (char*)(ifs + ctx->num + 1);
100 for (i = ctx->num, d = ifs, s = ctx->list; i; i--, s++, d++) {
111 free(ctx->list);