From 37806a2d7e552687ba52c82224cef8a76db5bcc8 Mon Sep 17 00:00:00 2001 From: angie Date: Sat, 24 Dec 2022 10:15:49 -0300 Subject: [PATCH] some docs fixes --- docs/usage_c_api.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/usage_c_api.md b/docs/usage_c_api.md index d8c7bcf..14a4dee 100644 --- a/docs/usage_c_api.md +++ b/docs/usage_c_api.md @@ -81,13 +81,14 @@ has been passed to this pair of functions. 3. Disassembling into a string -To produce a string disassembly of the word we passed we could simply call to +To disassemble the passed word as a string we can call `RabbitizerInstruction_disassemble`. This function expects a `char` buffer to fill, which should have enough space to hold the resulting string. To know how big this buffer needs to be we should use the `RabbitizerInstruction_getSizeForBuffer` function which calculates a size big enough to hold the disassembled string for the passed instruction (without -taking into account the finalizing NUL character). +taking into account the finalizing NUL character, similar to how `strlen` +behaves). With this information we can just `malloc` our buffer and call `RabbitizerInstruction_disassemble` to get our disassembled instruction. @@ -114,6 +115,10 @@ Not much to say here, just print the disassembled instruction to `stdout`. Finally since we know we won't be using the produced string or the instruction we just `free` and `RabbitizerInstruction_destroy` them. +As a curiosity, `RabbitizerInstruction_destroy` currently does nothing, but +exists in case some destruction is needed in the future, so it recommended to +call this function as a future-proof method. + ```c free(buffer); RabbitizerInstruction_destroy(&instr);