Create IbisTags

Review Request #3167 — Created May 7, 2024 and submitted

Information

ibis/ibis
default

Reviewers

This object simplifies the interactions with tags. The user only ever deals
with the raw tag values. The parser will unescape the tags and store them in
the tags objects. Likewise, the serializer will escape the tags as it outputs
them.

Right now the tags object works like an ordered hash table. This is mostly for
unit tests, but is probably fine going forward. That said, I'm not particularly
fond of the implementation, but it does work so it's good enough for now.

Ran the parser and tags tests under valgrind.
Called in the turtles as well.

Summary ID
Create IbisTags
This object simplifies the interactions with tags. The user only ever deals with the raw tag values. The parser will unescape the tags and store them in the tags objects. Likewise, the serializer will escape the tags as it outputs them. Right now the tags object works like an ordered hash table. This is mostly for unit tests, but is probably fine going forward. That said, I'm not particularly fond of the implementation, but it does work so it's good enough for now.
5a6bbdc3dcdee62a29a6407747aec522a821c614
Description From Last Updated

Don't need the outer if since g_set_object should handle that.

QuLogicQuLogic

'for managing'? or 'to manage'?

QuLogicQuLogic

I don't think this correctly handles duplicate calls with the same key. Since the hash table owns the string, the …

QuLogicQuLogic

Comment should be deleted now.

QuLogicQuLogic

empty/missing values, I think, not tags.

QuLogicQuLogic

Remove?

QuLogicQuLogic

Can also add a parser test with duplicate tags in the input; I believe the spec says to use the …

QuLogicQuLogic

escapes?

QuLogicQuLogic
grim
QuLogic
  1. 
      
  2. ibis/ibismessage.c (Diff revision 2)
     
     
    Show all issues

    Don't need the outer if since g_set_object should handle that.

  3. ibis/ibistags.h (Diff revision 2)
     
     
    Show all issues

    'for managing'? or 'to manage'?

  4. ibis/ibistags.c (Diff revision 2)
     
     
     
     
    Show all issues

    I don't think this correctly handles duplicate calls with the same key. Since the hash table owns the string, the queue needs to be in sync with it. But g_hash_table_insert will free new_key if it's a duplicate, making this insertion into the queue invalid. You could use g_hash_table_replace instead, but then you need to remove the old key pointer from the queue.

    I see only one test with repeated keys, but it's used for comparing with ibis_tags_parse, so won't iterate over tags->keys.

    So there's a missing test for duplicate keys with ibis_tags_serialize, which would access tags->keys.

    1. Sorry, the test with repeated keys is only for ibis_parser_parse, not ibis_tags_parse (though I guess it does effectively call that too).

  5. ibis/ibistags.c (Diff revision 2)
     
     
     
     
     
     
     
    Show all issues

    Comment should be deleted now.

  6. 
      
grim
QuLogic
  1. 
      
  2. ibis/ibistags.c (Diff revisions 2 - 3)
     
     
     
    Show all issues

    empty/missing values, I think, not tags.

  3. ibis/tests/test_tags.c (Diff revisions 2 - 3)
     
     
    Show all issues

    Remove?

  4. ibis/tests/test_tags.c (Diff revisions 2 - 3)
     
     
     
     
     
     
     
     
     
     
     
     
     
    Show all issues

    Can also add a parser test with duplicate tags in the input; I believe the spec says to use the last one.

  5. ibis/tests/test_tags.c (Diff revisions 2 - 3)
     
     
    Show all issues

    escapes?

  6. 
      
grim
QuLogic
  1. Ship It!
  2. 
      
grim
Review request changed
Status:
Completed