summaryrefslogtreecommitdiffstats
path: root/src/types.c
diff options
context:
space:
mode:
authorAnastasios Grammenos <anastasios.grammenos@noris.gr>2022-10-23 21:05:57 +0300
committerAnastasios Grammenos <anastasios.grammenos@noris.gr>2022-10-23 21:05:57 +0300
commit51d16373fbaa027e91f230a7423ebb1b2d339042 (patch)
tree9f088ae6544eb646c9c90e2323beeab9663e4360 /src/types.c
parent7c5af1b2768247984a08569b35e47ff927e70389 (diff)
downloadfoodtools-51d16373fbaa027e91f230a7423ebb1b2d339042.tar.gz
foodtools-51d16373fbaa027e91f230a7423ebb1b2d339042.tar.bz2
foodtools-51d16373fbaa027e91f230a7423ebb1b2d339042.zip
More
Diffstat (limited to 'src/types.c')
-rw-r--r--src/types.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/types.c b/src/types.c
index 68c402c..8debe70 100644
--- a/src/types.c
+++ b/src/types.c
@@ -74,6 +74,7 @@ new_step(recipe * r)
if (!r->s[r->sn])
die("Couldn't allocate memory for step");
r->s[r->sn]->inst = NULL;
+ r->s[r->sn]->txt = NULL;
r->s[r->sn]->duration = NULL;
r->s[r->sn]->result = NULL;
r->s[r->sn]->type = 0;
@@ -87,6 +88,8 @@ free_step(step * s)
return;
if (s->inst)
free(s->inst);
+ if (s->txt)
+ free(s->txt);
if (s->duration)
free(s->duration);
if (s->result)
@@ -220,8 +223,8 @@ tojson(recipe * r)
printf(",\"steps\":[");
int i = 0;
for (; i < r->sn - 1; i++)
- printf("{\"inst\":\"%s\",\"duration\":\"%s\",\"result\":\"%s\",\"type\":\"%s\"},", r->s[i]->inst, r->s[i]->duration, r->s[i]->result, r->s[i]->type == 0 ? "prep" : (r->s[i]->type == 1 ? "cook" : "serve") );
- printf("{\"inst\":\"%s\",\"duration\":\"%s\",\"result\":\"%s\",\"type\":\"%s\"}]", r->s[i]->inst, r->s[i]->duration, r->s[i]->result, r->s[i]->type == 0 ? "prep" : (r->s[i]->type == 1 ? "cook" : "serve") );
+ printf("{\"inst\":\"%s\",\"txt\":\"%s\",\"duration\":\"%s\",\"result\":\"%s\",\"type\":\"%s\"},", r->s[i]->inst, r->s[i]->txt, r->s[i]->duration, r->s[i]->result, r->s[i]->type == 0 ? "prep" : (r->s[i]->type == 1 ? "cook" : "serve") );
+ printf("{\"inst\":\"%s\",\"txt\":\"%s\",\"duration\":\"%s\",\"result\":\"%s\",\"type\":\"%s\"}]", r->s[i]->inst, r->s[i]->txt, r->s[i]->duration, r->s[i]->result, r->s[i]->type == 0 ? "prep" : (r->s[i]->type == 1 ? "cook" : "serve") );
}
printf("}");
}