aboutgitcodelistschat:MatrixIRC
diff options
context:
space:
mode:
authorAlice Frosi <afrosi@redhat.com>2023-06-05 16:54:12 +0200
committerAlice Frosi <afrosi@redhat.com>2023-06-05 16:54:12 +0200
commit3b9f21c6c3f06fd5049aa43f116906417d92e11f (patch)
treec56d8857408efb99c13f4af458b14d88fd078a40
parentcbf5a607bcd638a1fc8c5b212e1d360528a55b19 (diff)
downloadseitan-3b9f21c6c3f06fd5049aa43f116906417d92e11f.tar
seitan-3b9f21c6c3f06fd5049aa43f116906417d92e11f.tar.gz
seitan-3b9f21c6c3f06fd5049aa43f116906417d92e11f.tar.bz2
seitan-3b9f21c6c3f06fd5049aa43f116906417d92e11f.tar.lz
seitan-3b9f21c6c3f06fd5049aa43f116906417d92e11f.tar.xz
seitan-3b9f21c6c3f06fd5049aa43f116906417d92e11f.tar.zst
seitan-3b9f21c6c3f06fd5049aa43f116906417d92e11f.zip
cooker: use unsigned short for family with connect
-rw-r--r--cooker/call.c2
-rw-r--r--cooker/calls/net.c2
-rw-r--r--cooker/cooker.h3
-rw-r--r--cooker/emit.c3
-rw-r--r--cooker/gluten.c1
-rw-r--r--cooker/match.c1
6 files changed, 9 insertions, 3 deletions
diff --git a/cooker/call.c b/cooker/call.c
index d44ff6f..1c29db8 100644
--- a/cooker/call.c
+++ b/cooker/call.c
@@ -139,6 +139,7 @@ static union value parse_field(struct gluten_ctx *g, struct arg *args,
return v;
switch (f->type) {
+ case USHORT:
case INT:
case LONG:
case U32:
@@ -245,6 +246,7 @@ bool arg_needs_temp(struct field *f, int pos, JSON_Value *jvalue,
}
switch (f->type) {
+ case USHORT:
case INT:
case LONG:
case U32:
diff --git a/cooker/calls/net.c b/cooker/calls/net.c
index 7231a0e..7a7fd33 100644
--- a/cooker/calls/net.c
+++ b/cooker/calls/net.c
@@ -162,7 +162,7 @@ static struct field connect_addr_nl[] = {
};
static struct field connect_family = {
- "family", INT, 0,
+ "family", USHORT, 0,
offsetof(struct sockaddr, sa_family),
0, { .d_num = af }
};
diff --git a/cooker/cooker.h b/cooker/cooker.h
index 40277c2..7a14221 100644
--- a/cooker/cooker.h
+++ b/cooker/cooker.h
@@ -64,6 +64,7 @@ enum type {
UNDEF = 0,
NONE,
+ USHORT,
INT,
U32,
U64,
@@ -107,7 +108,7 @@ enum flags {
#define TYPE_IS_COMPOUND(t) \
((t) == STRUCT || (t) == SELECT)
#define TYPE_IS_NUM(t) \
- ((t) == INT || (t) == U32 || (t) == U64 || (t) == LONG)
+ ((t) == INT || (t) == U32 || (t) == U64 || (t) == LONG || (t) == USHORT)
/**
* struct num - A numeric value and its label
diff --git a/cooker/emit.c b/cooker/emit.c
index 4303115..4be5d35 100644
--- a/cooker/emit.c
+++ b/cooker/emit.c
@@ -16,7 +16,7 @@
static const char *type_str[] = {
"UNDEF", "NONE",
- "INT", "U32", "U64", "LONG",
+ "USHORT", "INT", "U32", "U64", "LONG",
"STRING",
"STRUCT", "SELECT",
"PID",
@@ -331,6 +331,7 @@ static struct gluten_offset emit_data_do(struct gluten_ctx *g,
}
switch (type) {
+ case USHORT:
case INT:
if (add) {
*(int *)p |= value->v_int;
diff --git a/cooker/gluten.c b/cooker/gluten.c
index 01c2369..cb9ecfb 100644
--- a/cooker/gluten.c
+++ b/cooker/gluten.c
@@ -13,6 +13,7 @@
#include "util.h"
size_t gluten_size[TYPE_COUNT] = {
+ [USHORT] = sizeof(unsigned short),
[INT] = sizeof(int),
[U32] = sizeof(uint32_t),
[U64] = sizeof(uint64_t),
diff --git a/cooker/match.c b/cooker/match.c
index 593cd55..c53a456 100644
--- a/cooker/match.c
+++ b/cooker/match.c
@@ -103,6 +103,7 @@ static union value parse_field(struct gluten_ctx *g,
offset.offset += f->offset;
switch (f->type) {
+ case USHORT:
case INT:
case LONG:
case U32: