Uploaded image for project: 'Qpid'
  1. Qpid
  2. QPID-5489

C++ Uuid code needs cleaning up



    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 0.29
    • C++ Broker, C++ Clustering
    • None
    • FreeBSD


      The Uuid encapsulating code is a bit of a mess in qpid:
      There are 2 nearly parallel implementations with only minor differences - qpid::framing::Uuid and qpid::types::Uuid. The reason for this historical with types::Uuids being written to supplant framing::Uuid to avoid its pernicious dependencies.

      However at this point the framing version is not widely used and can be mostly removed in favour of the types version.

      Added to this is an issue in the FreeBSD port: This has a uuid_compare() function actually implemented in libc - in addition to the one in libuuid. The two are incompatible. However the version in libc seems to be used preferentially even if libuuid is linked in - I'm not sure why.

      So it would be a good idea to just avoid uuid_compare completely. Fortunately we can in fact do this - we hold uuids in memory in the same order that they appear on the wire (for easy receiving and sending) in this case the uuid_compare is actually exactly the same as doing a memcmp() over the raw bytes.

      It turns out that once you have done this the only library calls that we are left meeding are uuid_generate(), uuid_parse() & uuid_unparse(). And _parse and _unparse would be very simple to replace because they just read/write the bytes in the order that we keep them in memory and add/remove '-' characters in the correct place.




            astitcher Andrew Stitcher
            astitcher Andrew Stitcher
            0 Vote for this issue
            3 Start watching this issue