-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle temporary string xml attributes #24
Handle temporary string xml attributes #24
Conversation
@robbr48 This "fixes" causality attribute handling, but there are other attributes being read similarly (but differently) that should be looked over. I realized that these strings are temporary and only used to select which enum value (or similar) to set. Maybe instead of duplicating the strings (and having to deal with freeing them) we could make an additional ezxml get attribute function that returns the const char* (or null ptr) to the attribute string, and use that directly for comparison instead. |
I'm not really sure what problem this fixes? If |
The problem is that if My "fix" (I dont like it) is to always ensure _strdup has been called, so that we always need to free it. Instead of having a situation where we must have logic that decides if we should free it or not. But in this particular case where we do not even want to keep the causality string, why do we even need to _strdupe it? In fact, the more I think about it, maybe we should replace the |
I made a new attempt at a slightly better solution. |
Ok, I see the problem and you solution is reasonable. You have a good point that we don't need to duplicate the string if we don't want to keep it. I want all the XML utility functions to be harmonized though, so if we change one we should change all (or add separate functions for different behaviour). |
I guess my updated solution is a reasonable middle ground, then we do not need to add additional xml parsing functions. |
411ac8e
to
f2108cd
Compare
@robbr48 Ready for review, there are some TODOs in the code that I need input on. Essentially missing default values or handling about unknown values. Also look extra closely on the "clocks" handling, I am not sure if it still works as it is supposed to. The changes are mostly in the start and end of each changed code block. |
There were too many conflicts and much work has already been covered by other commits, so I recreated what was left in this PR as #44. |
Example on handling temp xml string attributes differently