Distributed File System written in C

docs: Add doc comments to uuid.h & uuid.c

+14 -2
+4 -2
src/lib/uuid.c
··· 7 7 8 8 ImplList(HexByte) 9 9 10 + // INFO: This monstrosity looks like this because I didn't see the use of 11 + // writing a for-loop for 36 bytes. 10 12 UUID_Str utoa(UUID uuid) { 11 13 HexByte b01 = to_hex1((Byte)(uuid.id1 >> 24) & 0xFF); 12 14 HexByte b02 = to_hex1((Byte)(uuid.id1 >> 16) & 0xFF); ··· 27 29 return (UUID_Str){ .uuid = { b01.l, b01.r, b01.l, b01.r, b02.l, b02.r, b03.l, b03.r, b04.l, b04.r, '-', b05.l, b05.r, b06.l, b06.r, '-', b07.l, b07.r, b08.l, b08.r, '-', b09.l, b09.r, b10.l, b10.r, '-', b11.l, b11.r, b12.l, b12.r, b13.l, b13.r, b14.l, b14.r, b15.l, b15.r, b16.l, b16.r, '\0' } }; 28 30 } 29 31 30 - 31 32 bool UUID_eq(UUID l, UUID r) { 32 33 return l.id1 == r.id1 33 34 && l.id2 == r.id2 ··· 35 36 && l.id4 == r.id4 36 37 && l.id5 == r.id5; 37 38 } 38 - 39 39 40 40 Buffer UUID_serialize(UUID in) { 41 41 return to_buffer(&in, sizeof(UUID)); ··· 114 114 free(kod); 115 115 } 116 116 117 + // INFO: This is necessary to avoid the "conversion" warning because you're 118 + // assigning a uint64_t to a uint64_t:48 (which is 16 bits less). 117 119 #pragma GCC diagnostic push 118 120 #pragma GCC diagnostic ignored "-Wconversion" 119 121 return (UUID) {
+10
src/lib/uuid.h
··· 45 45 46 46 DefList(HexByte) 47 47 48 + /// Convert a UUID into a string. 49 + /// In order to actually get the string, you have to do: 50 + /// \code{.c} 51 + /// utoa(your_id_here).uuid; 52 + /// \endcode 53 + /// 54 + /// INFO: The caller does not have to free the memory! ;) 55 + /// 56 + /// @param uuid the UUID that you want a string for 57 + /// @return a UUID_Str representing that UUID 48 58 UUID_Str utoa(UUID uuid); 49 59 50 60 /// Serialize a UUID into a Buffer.