tlog
tlog copied to clipboard
Implement error handling macros
Throughout the code several error-handling patterns are repeated many times. Implement macros to handle the most typical cases and save on line count.
Hi Nick, could you write some example about error-handling patterns are repeated in code?
Hi Hai, Here is one which is repeated often: https://github.com/Scribery/tlog/blob/master/src/tlog-rec.c#L67-L69 Here is another which can be implemented as the previous one: https://github.com/Scribery/tlog/blob/master/src/tlog-rec.c#L85-L87 And another: https://github.com/Scribery/tlog/blob/master/src/tlog-play.c#L130-L132
Look around and you'll find some that are repeating.
Hi Nick, before doing that, do you want to add line, function, file ( the same debug output) into stack err? It is convenient because when you have many error in stack, it will report information about them for you.
We can do that later. I'd rather not add that yet, as there wasn't much need for it so far, and it would increase the code size.
Hi Nick, I see there are 4 different types repeated. Should I write 4 function in Header to handle them?
1. pushf
2. pushs
3. pushc, then pushf
4. pushc, then pushs
What do you think?
I think I'll be able to understand you better, if I just saw the code you want to write :) Just make a PR with the macros you want to add and then let's discuss it.
Hi Nick, I should write more specific about the code :). I send the first draft to new pull request for this issue.