use //-style single line comments everywhere

Sun, 20 Nov 2022 21:08:36 +0100

author
Mike Becker <universe@uap-core.de>
date
Sun, 20 Nov 2022 21:08:36 +0100
changeset 628
1e2be40f0cb5
parent 627
cc8cbabd27cd
child 629
6c81ee4f11ad

use //-style single line comments everywhere

docs/src/modules-ucx2.md file | annotate | diff | comparison | revisions
src/allocator.c file | annotate | diff | comparison | revisions
src/array_list.c file | annotate | diff | comparison | revisions
src/cx/allocator.h file | annotate | diff | comparison | revisions
src/cx/array_list.h file | annotate | diff | comparison | revisions
src/cx/buffer.h file | annotate | diff | comparison | revisions
src/cx/common.h file | annotate | diff | comparison | revisions
src/cx/hash_key.h file | annotate | diff | comparison | revisions
src/cx/iterator.h file | annotate | diff | comparison | revisions
src/cx/linked_list.h file | annotate | diff | comparison | revisions
src/cx/list.h file | annotate | diff | comparison | revisions
src/cx/tree.h file | annotate | diff | comparison | revisions
src/cx/utils.h file | annotate | diff | comparison | revisions
src/hash_key.c file | annotate | diff | comparison | revisions
src/linked_list.c file | annotate | diff | comparison | revisions
src/list.c file | annotate | diff | comparison | revisions
src/string.c file | annotate | diff | comparison | revisions
test/test_string.cpp file | annotate | diff | comparison | revisions
test/util_allocator.h file | annotate | diff | comparison | revisions
     1.1 --- a/docs/src/modules-ucx2.md	Sun Nov 20 17:48:42 2022 +0100
     1.2 +++ b/docs/src/modules-ucx2.md	Sun Nov 20 21:08:36 2022 +0100
     1.3 @@ -75,20 +75,20 @@
     1.4      return result;
     1.5  }
     1.6  
     1.7 -/* ... */
     1.8 +// ... 
     1.9  
    1.10 -sstr_t* array = /* some standard array of strings */
    1.11 -size_t arrlen = /* the length of the array */
    1.12 +sstr_t* array = // some standard array of strings 
    1.13 +size_t arrlen = // the length of the array 
    1.14  
    1.15  UcxArray* result = create_unique(array,arrlen);
    1.16  
    1.17 -/* Iterate over the array and print the elements */
    1.18 +// Iterate over the array and print the elements 
    1.19  sstr_t* unique = result->data;
    1.20  for (size_t i = 0 ; i < result->size ; i++) {
    1.21      printf("%" PRIsstr "\n", SFMT(unique[i]));
    1.22  }
    1.23  
    1.24 -/* Free the array. */
    1.25 +// Free the array. 
    1.26  ucx_array_free(result);
    1.27  ```
    1.28  ### Preventing out of bounds writes
    1.29 @@ -128,23 +128,18 @@
    1.30  is to find all items within a time window `[t_start, t_end]`.
    1.31  With AVL Trees this is easy:
    1.32  ```C
    1.33 -/* ---------------------
    1.34 - * Somewhere in a header
    1.35 - */
    1.36 +// Somewhere in a header
    1.37  typedef struct {
    1.38      time_t ts;
    1.39 -    /* other important data */
    1.40 +    // other important data 
    1.41  } MyObject;
    1.42  
    1.43 -/* -----------
    1.44 - * Source code
    1.45 - */
    1.46 +// Source code
    1.47 +UcxAVLTree* tree = ucx_avl_new(ucx_cmp_longint);
    1.48 +// ... populate tree with objects, use '& MyObject.ts' as key ... 
    1.49  
    1.50 -UcxAVLTree* tree = ucx_avl_new(ucx_cmp_longint);
    1.51 -/* ... populate tree with objects, use '& MyObject.ts' as key ... */
    1.52  
    1.53 -
    1.54 -/* Now find every item, with 30 <= ts <= 70 */
    1.55 +// Now find every item, with 30 <= ts <= 70 
    1.56  time_t ts_start = 30;
    1.57  time_t ts_end = 70;
    1.58  
    1.59 @@ -212,18 +207,18 @@
    1.60  
    1.61      UcxBuffer* linebuf =
    1.62          ucx_buffer_new(
    1.63 -            NULL,       /* the buffer should manage the memory area for us */
    1.64 -            2*chunksize,  /* initial size should be twice the chunk size */
    1.65 -            UCX_BUFFER_AUTOEXTEND); /* the buffer will grow when necessary */
    1.66 +            NULL,       // the buffer should manage the memory area for us 
    1.67 +            2*chunksize,  // initial size should be twice the chunk size 
    1.68 +            UCX_BUFFER_AUTOEXTEND); // the buffer will grow when necessary 
    1.69  
    1.70      size_t lineno = 1;
    1.71      do {
    1.72 -        /* read line chunk */
    1.73 +        // read line chunk 
    1.74          size_t read = ucx_stream_ncopy(
    1.75                  input, linebuf, fread, ucx_buffer_write, chunksize);
    1.76          if (read == 0) break;
    1.77          
    1.78 -        /* handle line endings */
    1.79 +        // handle line endings 
    1.80          do {
    1.81              sstr_t bufstr = ucx_buffer_to_sstr(linebuf);
    1.82              sstr_t nl = sstrchr(bufstr, '\n');
    1.83 @@ -234,13 +229,13 @@
    1.84  
    1.85              printf("%zu: %" PRIsstr "\n", lineno++, SFMT(linestr));
    1.86  
    1.87 -            /* shift the buffer to the next line */
    1.88 +            // shift the buffer to the next line 
    1.89              ucx_buffer_shift_left(linebuf, linelen+1);
    1.90          } while(1);
    1.91  
    1.92      } while(1);
    1.93  
    1.94 -    /* print the 'noeol' line, if any */
    1.95 +    // print the 'noeol' line, if any 
    1.96      sstr_t lastline = ucx_buffer_to_sstr(linebuf);
    1.97      if (lastline.length > 0) {
    1.98          printf("%zu: %" PRIsstr, lineno, SFMT(lastline));
    1.99 @@ -286,27 +281,27 @@
   1.100      return list;
   1.101  }
   1.102  
   1.103 -/* we will need this function to clean up the list contents later */
   1.104 +// we will need this function to clean up the list contents later 
   1.105  void free_sstr(void* ptr) {
   1.106      sstr_t* s = ptr;
   1.107      free(s->ptr);
   1.108      free(s);
   1.109  }
   1.110  
   1.111 -/* ... */
   1.112 +// ... 
   1.113  
   1.114 -sstr_t* array = /* some array of strings */
   1.115 -size_t arrlen = /* the length of the array */
   1.116 +sstr_t* array = // some array of strings 
   1.117 +size_t arrlen = // the length of the array 
   1.118  
   1.119  UcxList* list = remove_duplicates(array,arrlen);
   1.120  
   1.121 -/* Iterate over the list and print the elements */
   1.122 +// Iterate over the list and print the elements 
   1.123  UCX_FOREACH(elem, list) {
   1.124      sstr_t s = *((sstr_t*)elem->data);
   1.125      printf("%" PRIsstr "\n", SFMT(s));
   1.126  }
   1.127  
   1.128 -/* Use our free function to free the duplicated strings. */
   1.129 +// Use our free function to free the duplicated strings. 
   1.130  ucx_list_free_content(list, free_sstr);
   1.131  ucx_list_free(list);
   1.132  ```
   1.133 @@ -392,7 +387,7 @@
   1.134              ucx_map_cstr_put(options, option, arg);
   1.135              option = NULL;
   1.136          } else {
   1.137 -            /* ... handle argument that is not an option ... */
   1.138 +            // ... handle argument that is not an option ... 
   1.139          }
   1.140      }
   1.141      if(option) {
   1.142 @@ -463,20 +458,20 @@
   1.143          perror("Cannot open file");
   1.144          return 1;
   1.145      }
   1.146 -    /* close the file automatically at pool destruction*/
   1.147 +    // close the file automatically at pool destruction
   1.148      ucx_mempool_reg_destr(pool, f, (ucx_destructor) fclose);
   1.149  
   1.150 -    /* create a buffer and register it at the memory pool for destruction */
   1.151 +    // create a buffer and register it at the memory pool for destruction 
   1.152      UcxBuffer* content = ucx_buffer_new(NULL, 256, UCX_BUFFER_AUTOEXTEND);
   1.153      ucx_mempool_reg_destr(pool, content, (ucx_destructor) ucx_buffer_free);
   1.154  
   1.155 -    /* read the file and split it by lines first */
   1.156 +    // read the file and split it by lines first 
   1.157      ucx_stream_copy(f, content, fread, ucx_buffer_write);
   1.158      sstr_t contentstr = ucx_buffer_to_sstr(content);
   1.159      ssize_t lc = 0;
   1.160      sstr_t* lines = sstrsplit_a(pool->allocator, contentstr, S("\n"), &lc);
   1.161  
   1.162 -    /* skip the header and parse the remaining data */
   1.163 +    // skip the header and parse the remaining data 
   1.164      UcxList* datalist = NULL;
   1.165      for (size_t i = 1 ; i < lc ; i++) {
   1.166          if (lines[i].length == 0) continue;
   1.167 @@ -494,7 +489,7 @@
   1.168          datalist = ucx_list_append_a(pool->allocator, datalist, data);
   1.169      }
   1.170  
   1.171 -    /* control output */
   1.172 +    // control output 
   1.173      UCX_FOREACH(elem, datalist) {
   1.174          CSVData* data = elem->data;
   1.175          printf("Column A: %" PRIsstr " | "
   1.176 @@ -504,7 +499,7 @@
   1.177          );
   1.178      }
   1.179  
   1.180 -    /* cleanup everything, no manual free() needed */
   1.181 +    // cleanup everything, no manual free() needed 
   1.182      ucx_mempool_destroy(pool);
   1.183  
   1.184      return 0;
   1.185 @@ -519,10 +514,10 @@
   1.186  ```C
   1.187      MyObject* obj = ucx_mempool_malloc(pool, sizeof(MyObject));
   1.188  
   1.189 -    /* some special initialization with own resource management */
   1.190 +    // some special initialization with own resource management 
   1.191      my_object_init(obj);
   1.192  
   1.193 -    /* register destructor function */
   1.194 +    // register destructor function 
   1.195      ucx_mempool_set_destr(obj, (ucx_destructor) my_object_destroy);
   1.196  ```
   1.197  Be aware, that your destructor function should not free any memory, that is
   1.198 @@ -544,30 +539,30 @@
   1.199  ### Example: Loading properties from a file
   1.200  
   1.201  ```C
   1.202 -/* Open the file as usual */
   1.203 +// Open the file as usual 
   1.204  FILE* file = fopen("myprops.properties", "r");
   1.205  if (!file) {
   1.206      // error handling
   1.207      return 1;
   1.208  }
   1.209  
   1.210 -/* Load the properties from the file */
   1.211 +// Load the properties from the file 
   1.212  UcxMap* myprops = ucx_map_new(16);
   1.213  if (ucx_properties_load(myprops, file)) {
   1.214 -    /* ... error handling ... */
   1.215 +    // ... error handling ... 
   1.216      fclose(file);
   1.217      ucx_map_free(myprops);
   1.218      return 1;
   1.219  }
   1.220  
   1.221 -/* Print out the key/value pairs */
   1.222 +// Print out the key/value pairs 
   1.223  char* propval;
   1.224  UcxMapIterator propiter = ucx_map_iterator(myprops);
   1.225  UCX_MAP_FOREACH(key, propval, propiter) {
   1.226      printf("%s = %s\n", (char*)key.data, propval);
   1.227  }
   1.228  
   1.229 -/* Don't forget to free the values before freeing the map */
   1.230 +// Don't forget to free the values before freeing the map 
   1.231  ucx_map_free_content(myprops, NULL);
   1.232  ucx_map_free(myprops);
   1.233  fclose(file);
   1.234 @@ -599,30 +594,30 @@
   1.235      const char* str = "Hello!";
   1.236      size_t strn = 7;
   1.237  
   1.238 -    /* push the integer */
   1.239 +    // push the integer 
   1.240      ucx_stack_push(&stack, sizeof(int), &i);
   1.241  
   1.242 -    /* push the float and rember the address */
   1.243 +    // push the float and rember the address 
   1.244      float* remember = ucx_stack_push(&stack, sizeof(float), &f);
   1.245  
   1.246 -    /* push the string with zero terminator */
   1.247 +    // push the string with zero terminator 
   1.248      ucx_stack_push(&stack, strn, str);
   1.249  
   1.250 -    /* if we forget, how big an element was, we can ask the stack */
   1.251 +    // if we forget, how big an element was, we can ask the stack 
   1.252      printf("Length of string: %zu\n", ucx_stack_topsize(&stack)-1);
   1.253  
   1.254 -    /* retrieve the string as sstr_t, without zero terminator! */
   1.255 +    // retrieve the string as sstr_t, without zero terminator! 
   1.256      sstr_t s;
   1.257      s.length = ucx_stack_topsize(&stack)-1;
   1.258      s.ptr = malloc(s.length);
   1.259      ucx_stack_popn(&stack, s.ptr, s.length);
   1.260      printf("%" PRIsstr "\n", SFMT(s));
   1.261  
   1.262 -    /* print the float directly from the stack and free it */
   1.263 +    // print the float directly from the stack and free it 
   1.264      printf("Float: %f\n", *remember);
   1.265      ucx_stack_free(&stack, remember);
   1.266  
   1.267 -    /* the last element is the integer */
   1.268 +    // the last element is the integer 
   1.269      int j;
   1.270      ucx_stack_pop(&stack, &j);
   1.271      printf("Integer: %d\n", j);
   1.272 @@ -647,21 +642,21 @@
   1.273  There are several ways to create an `sstr_t`:
   1.274  
   1.275  ```C
   1.276 -/* (1) sstr() uses strlen() internally, hence cstr MUST be zero-terminated */
   1.277 +// (1) sstr() uses strlen() internally, hence cstr MUST be zero-terminated 
   1.278  sstr_t a = sstr(cstr);
   1.279  
   1.280 -/* (2) cstr does not need to be zero-terminated, if length is specified */
   1.281 +// (2) cstr does not need to be zero-terminated, if length is specified 
   1.282  sstr_t b = sstrn(cstr, len);
   1.283  
   1.284 -/* (3) S() macro creates sstr_t from a string using sizeof() and using sstrn().
   1.285 -       This version is especially useful for function arguments */
   1.286 +// (3) S() macro creates sstr_t from a string using sizeof() and using sstrn().
   1.287 +//     This version is especially useful for function arguments
   1.288  sstr_t c = S("hello");
   1.289  
   1.290 -/* (4) SC() macro works like S(), but makes the string immutable using scstr_t.
   1.291 -       (available since UCX 2.0) */
   1.292 +// (4) SC() macro works like S(), but makes the string immutable using scstr_t.
   1.293 +//     (available since UCX 2.0)
   1.294  scstr_t d = SC("hello");
   1.295  
   1.296 -/* (5) ST() macro creates sstr_t struct literal using sizeof() */
   1.297 +// (5) ST() macro creates sstr_t struct literal using sizeof() 
   1.298  sstr_t e = ST("hello");
   1.299  ```
   1.300  
   1.301 @@ -716,12 +711,12 @@
   1.302  sstr_t test = ST("here::are::some::strings");
   1.303  sstr_t delim = ST("::");
   1.304  
   1.305 -ssize_t count = 0; /* no limit */
   1.306 +ssize_t count = 0; // no limit 
   1.307  UcxMempool* pool = ucx_mempool_new_default();
   1.308  
   1.309  sstr_t* result = sstrsplit_a(pool->allocator, test, delim, &count);
   1.310  for (ssize_t i = 0 ; i < count ; i++) {
   1.311 -    /* don't forget to specify the length via the %*s format specifier */
   1.312 +    // don't forget to specify the length via the %*s format specifier 
   1.313      printf("%*s\n", result[i].length, result[i].ptr);
   1.314  }
   1.315  
   1.316 @@ -762,32 +757,30 @@
   1.317  You should declare test cases and subroutines in a header file per test unit
   1.318  and implement them as you would implement normal functions.
   1.319  ```C
   1.320 -    /* myunit.h */
   1.321 +    // myunit.h 
   1.322      UCX_TEST(function_name);
   1.323 -    UCX_TEST_SUBROUTINE(subroutine_name, paramlist); /* optional */
   1.324 +    UCX_TEST_SUBROUTINE(subroutine_name, paramlist); // optional 
   1.325  
   1.326  
   1.327 -    /* myunit.c */
   1.328 +    // myunit.c 
   1.329      UCX_TEST_SUBROUTINE(subroutine_name, paramlist) {
   1.330 -        /* ... reusable tests with UCX_TEST_ASSERT() ... */
   1.331 +        // ... reusable tests with UCX_TEST_ASSERT() ... 
   1.332      }
   1.333  
   1.334      UCX_TEST(function_name) {
   1.335 -        /* ... resource allocation and other test preparation ... */
   1.336 +        // ... resource allocation and other test preparation ... 
   1.337  
   1.338 -        /* mandatory marker for the start of the tests */
   1.339 +        // mandatory marker for the start of the tests 
   1.340          UCX_TEST_BEGIN
   1.341  
   1.342 -        /*  ... verifications with UCX_TEST_ASSERT() ...
   1.343 -         * (and/or calls with UCX_TEST_CALL_SUBROUTINE())
   1.344 -         */
   1.345 +        //  ... verifications with UCX_TEST_ASSERT() ...
   1.346 +        // (and/or calls with UCX_TEST_CALL_SUBROUTINE())
   1.347  
   1.348 -        /* mandatory marker for the end of the tests */
   1.349 +        // mandatory marker for the end of the tests 
   1.350          UCX_TEST_END
   1.351  
   1.352 -        /* ... resource cleanup ...
   1.353 -         * (all code after UCX_TEST_END is always executed)
   1.354 -         */
   1.355 +        // ... resource cleanup ...
   1.356 +        // (all code after UCX_TEST_END is always executed)
   1.357      }
   1.358  ```
   1.359  If you want to use the `UCX_TEST_ASSERT()` macro in a function, you are
   1.360 @@ -800,8 +793,8 @@
   1.361      UcxTestSuite* suite = ucx_test_suite_new();
   1.362      ucx_test_register(suite, testMyTestCase01);
   1.363      ucx_test_register(suite, testMyTestCase02);
   1.364 -    /* ... */
   1.365 -    ucx_test_run(suite, stdout); /* stdout, or any other FILE stream */
   1.366 +    // ... 
   1.367 +    ucx_test_run(suite, stdout); // stdout, or any other FILE stream 
   1.368  ```
   1.369  
   1.370  ## Utilities
   1.371 @@ -831,7 +824,7 @@
   1.372          return 1;
   1.373      }
   1.374  
   1.375 -    FILE *srcf = fopen(argv[1], "r");   /* insert error handling on your own */
   1.376 +    FILE *srcf = fopen(argv[1], "r");   // insert error handling on your own 
   1.377      FILE *destf = fopen(argv[2], "w");
   1.378      
   1.379      size_t n =  ucx_stream_copy(srcf, destf, fread, fwrite);
   1.380 @@ -866,7 +859,7 @@
   1.381                          i, prime(i) ? "prime" : "not prime");
   1.382  }
   1.383  
   1.384 -/* print the result to stdout */
   1.385 +// print the result to stdout 
   1.386  printf("%s", (char*)strbuffer->space);
   1.387  
   1.388  ucx_buffer_free(strbuffer);
     2.1 --- a/src/allocator.c	Sun Nov 20 17:48:42 2022 +0100
     2.2 +++ b/src/allocator.c	Sun Nov 20 21:08:36 2022 +0100
     2.3 @@ -77,7 +77,7 @@
     2.4  };
     2.5  CxAllocator *cxDefaultAllocator = &cx_default_allocator;
     2.6  
     2.7 -/* IMPLEMENTATION OF HIGH LEVEL API */
     2.8 +// IMPLEMENTATION OF HIGH LEVEL API
     2.9  
    2.10  void *cxMalloc(
    2.11          CxAllocator const *allocator,
     3.1 --- a/src/array_list.c	Sun Nov 20 17:48:42 2022 +0100
     3.2 +++ b/src/array_list.c	Sun Nov 20 21:08:36 2022 +0100
     3.3 @@ -31,7 +31,7 @@
     3.4  #include <string.h>
     3.5  #include <stdint.h>
     3.6  
     3.7 -/* LOW LEVEL ARRAY LIST FUNCTIONS */
     3.8 +// LOW LEVEL ARRAY LIST FUNCTIONS
     3.9  
    3.10  enum cx_array_copy_result cx_array_copy(
    3.11          void **target,
    3.12 @@ -43,37 +43,37 @@
    3.13          size_t elem_count,
    3.14          struct cx_array_reallocator_s *reallocator
    3.15  ) {
    3.16 -    /* assert pointers */
    3.17 +    // assert pointers
    3.18      assert(target != NULL);
    3.19      assert(size != NULL);
    3.20      assert(src != NULL);
    3.21  
    3.22 -    /* determine capacity */
    3.23 +    // determine capacity
    3.24      size_t cap = capacity == NULL ? *size : *capacity;
    3.25  
    3.26 -    /* check if resize is required */
    3.27 +    // check if resize is required
    3.28      size_t minsize = index + elem_count;
    3.29      size_t newsize = *size < minsize ? minsize : *size;
    3.30      bool needrealloc = newsize > cap;
    3.31  
    3.32 -    /* reallocate if possible */
    3.33 +    // reallocate if possible
    3.34      if (needrealloc) {
    3.35 -        /* a reallocator and a capacity variable must be available */
    3.36 +        // a reallocator and a capacity variable must be available
    3.37          if (reallocator == NULL || capacity == NULL) {
    3.38              return CX_ARRAY_COPY_REALLOC_NOT_SUPPORTED;
    3.39          }
    3.40  
    3.41 -        /* check, if we need to repair the src pointer */
    3.42 +        // check, if we need to repair the src pointer
    3.43          uintptr_t targetaddr = (uintptr_t) *target;
    3.44          uintptr_t srcaddr = (uintptr_t) src;
    3.45          bool repairsrc = targetaddr <= srcaddr
    3.46                           && srcaddr < targetaddr + cap * elem_size;
    3.47  
    3.48 -        /* calculate new capacity (next number divisible by 16) */
    3.49 +        // calculate new capacity (next number divisible by 16)
    3.50          cap = newsize - (newsize % 16) + 16;
    3.51          assert(cap > newsize);
    3.52  
    3.53 -        /* perform reallocation */
    3.54 +        // perform reallocation
    3.55          void *newmem = reallocator->realloc(
    3.56                  *target, cap, elem_size, reallocator
    3.57          );
    3.58 @@ -81,25 +81,25 @@
    3.59              return CX_ARRAY_COPY_REALLOC_FAILED;
    3.60          }
    3.61  
    3.62 -        /* repair src pointer, if necessary */
    3.63 +        // repair src pointer, if necessary
    3.64          if (repairsrc) {
    3.65              src = ((char *) newmem) + (srcaddr - targetaddr);
    3.66          }
    3.67  
    3.68 -        /* store new pointer and capacity */
    3.69 +        // store new pointer and capacity
    3.70          *target = newmem;
    3.71          *capacity = cap;
    3.72      }
    3.73  
    3.74 -    /* determine target pointer */
    3.75 +    // determine target pointer
    3.76      char *start = *target;
    3.77      start += index * elem_size;
    3.78  
    3.79 -    /* copy elements and set new size */
    3.80 +    // copy elements and set new size
    3.81      memmove(start, src, elem_count * elem_size);
    3.82      *size = newsize;
    3.83  
    3.84 -    /* return successfully */
    3.85 +    // return successfully
    3.86      return CX_ARRAY_COPY_SUCCESS;
    3.87  }
    3.88  
    3.89 @@ -111,38 +111,38 @@
    3.90          size_t idx1,
    3.91          size_t idx2
    3.92  ) {
    3.93 -    /* short circuit */
    3.94 +    // short circuit
    3.95      if (idx1 == idx2) return;
    3.96  
    3.97      char sbo_mem[CX_ARRAY_SWAP_SBO_SIZE];
    3.98      void *tmp;
    3.99  
   3.100 -    /* decide if we can use the local buffer */
   3.101 +    // decide if we can use the local buffer
   3.102      if (elem_size > CX_ARRAY_SWAP_SBO_SIZE) {
   3.103          tmp = malloc(elem_size);
   3.104 -        /* we don't want to enforce error handling */
   3.105 +        // we don't want to enforce error handling
   3.106          if (tmp == NULL) abort();
   3.107      } else {
   3.108          tmp = sbo_mem;
   3.109      }
   3.110  
   3.111 -    /* calculate memory locations */
   3.112 +    // calculate memory locations
   3.113      char *left = arr, *right = arr;
   3.114      left += idx1 * elem_size;
   3.115      right += idx2 * elem_size;
   3.116  
   3.117 -    /* three-way swap */
   3.118 +    // three-way swap
   3.119      memcpy(tmp, left, elem_size);
   3.120      memcpy(left, right, elem_size);
   3.121      memcpy(right, tmp, elem_size);
   3.122  
   3.123 -    /* free dynamic memory, if it was needed */
   3.124 +    // free dynamic memory, if it was needed
   3.125      if (tmp != sbo_mem) {
   3.126          free(tmp);
   3.127      }
   3.128  }
   3.129  
   3.130 -/* HIGH LEVEL ARRAY LIST FUNCTIONS */
   3.131 +// HIGH LEVEL ARRAY LIST FUNCTIONS
   3.132  
   3.133  typedef struct {
   3.134      struct cx_list_s base;
   3.135 @@ -156,10 +156,10 @@
   3.136          size_t elem_size,
   3.137          struct cx_array_reallocator_s *alloc
   3.138  ) {
   3.139 -    /* retrieve the pointer to the list allocator */
   3.140 +    // retrieve the pointer to the list allocator
   3.141      CxAllocator const *al = alloc->ptr1;
   3.142  
   3.143 -    /* use the list allocator to reallocate the memory */
   3.144 +    // use the list allocator to reallocate the memory
   3.145      return cxRealloc(al, array, capacity * elem_size);
   3.146  }
   3.147  
   3.148 @@ -197,7 +197,7 @@
   3.149      } else {
   3.150          cx_array_list *arl = (cx_array_list *) list;
   3.151  
   3.152 -        /* move elements starting at index to the right */
   3.153 +        // move elements starting at index to the right
   3.154          if (cx_array_copy(
   3.155                  &arl->data,
   3.156                  &list->size,
   3.157 @@ -211,7 +211,7 @@
   3.158              return 1;
   3.159          }
   3.160  
   3.161 -        /* place the element */
   3.162 +        // place the element
   3.163          memcpy(((char *) arl->data) + index * list->itemsize,
   3.164                 elem, list->itemsize);
   3.165  
   3.166 @@ -247,18 +247,18 @@
   3.167          struct cx_list_s *list,
   3.168          size_t index
   3.169  ) {
   3.170 -    /* out-of-bounds check */
   3.171 +    // out-of-bounds check
   3.172      if (index >= list->size) {
   3.173          return 1;
   3.174      }
   3.175  
   3.176 -    /* short-circuit removal of last element */
   3.177 +    // short-circuit removal of last element
   3.178      if (index == list->size - 1) {
   3.179          list->size--;
   3.180          return 0;
   3.181      }
   3.182  
   3.183 -    /* just move the elements starting at index to the left */
   3.184 +    // just move the elements starting at index to the left
   3.185      cx_array_list *arl = (cx_array_list *) list;
   3.186      int result = cx_array_copy(
   3.187              &arl->data,
   3.188 @@ -271,7 +271,7 @@
   3.189              &arl->reallocator
   3.190      );
   3.191      if (result == 0) {
   3.192 -        /* decrease the size */
   3.193 +        // decrease the size
   3.194          list->size--;
   3.195      }
   3.196      return result;
   3.197 @@ -417,7 +417,7 @@
   3.198      list->base.itemsize = item_size;
   3.199      list->base.capacity = initial_capacity;
   3.200  
   3.201 -    /* configure the reallocator */
   3.202 +    // configure the reallocator
   3.203      list->reallocator.realloc = cx_arl_realloc;
   3.204      list->reallocator.ptr1 = (void *) allocator;
   3.205  
     4.1 --- a/src/cx/allocator.h	Sun Nov 20 17:48:42 2022 +0100
     4.2 +++ b/src/cx/allocator.h	Sun Nov 20 21:08:36 2022 +0100
     4.3 @@ -254,7 +254,7 @@
     4.4  __attribute__((__nonnull__));
     4.5  
     4.6  #ifdef __cplusplus
     4.7 -} /* extern "C" */
     4.8 +} // extern "C"
     4.9  #endif
    4.10  
    4.11 -#endif /* UCX_ALLOCATOR_H */
    4.12 +#endif // UCX_ALLOCATOR_H
     5.1 --- a/src/cx/array_list.h	Sun Nov 20 17:48:42 2022 +0100
     5.2 +++ b/src/cx/array_list.h	Sun Nov 20 21:08:36 2022 +0100
     5.3 @@ -166,7 +166,7 @@
     5.4  
     5.5  
     5.6  #ifdef __cplusplus
     5.7 -} /* extern "C" */
     5.8 +} // extern "C"
     5.9  #endif
    5.10  
    5.11 -#endif /* UCX_ARRAY_LIST_H */
    5.12 +#endif // UCX_ARRAY_LIST_H
     6.1 --- a/src/cx/buffer.h	Sun Nov 20 17:48:42 2022 +0100
     6.2 +++ b/src/cx/buffer.h	Sun Nov 20 21:08:36 2022 +0100
     6.3 @@ -411,4 +411,4 @@
     6.4  }
     6.5  #endif
     6.6  
     6.7 -#endif /* UCX_BUFFER_H */
     6.8 +#endif // UCX_BUFFER_H
     7.1 --- a/src/cx/common.h	Sun Nov 20 17:48:42 2022 +0100
     7.2 +++ b/src/cx/common.h	Sun Nov 20 21:08:36 2022 +0100
     7.3 @@ -110,12 +110,12 @@
     7.4  #else
     7.5  #define __WORDSIZE 32
     7.6  #endif
     7.7 -#endif /* __WORDSIZE */
     7.8 -#else /* !_WIN32 */
     7.9 +#endif // __WORDSIZE
    7.10 +#else // !_WIN32
    7.11  
    7.12  #include <sys/types.h>
    7.13  
    7.14 -#endif /* _WIN32 */
    7.15 +#endif // _WIN32
    7.16  
    7.17  #ifndef __GNUC__
    7.18  /**
    7.19 @@ -124,4 +124,4 @@
    7.20  #define __attribute__(x)
    7.21  #endif
    7.22  
    7.23 -#endif /* UCX_COMMON_H */
    7.24 +#endif // UCX_COMMON_H
     8.1 --- a/src/cx/hash_key.h	Sun Nov 20 17:48:42 2022 +0100
     8.2 +++ b/src/cx/hash_key.h	Sun Nov 20 21:08:36 2022 +0100
     8.3 @@ -125,4 +125,4 @@
     8.4  } // extern "C"
     8.5  #endif
     8.6  
     8.7 -#endif /* UCX_HASH_KEY_H */
     8.8 +#endif // UCX_HASH_KEY_H
     9.1 --- a/src/cx/iterator.h	Sun Nov 20 17:48:42 2022 +0100
     9.2 +++ b/src/cx/iterator.h	Sun Nov 20 21:08:36 2022 +0100
     9.3 @@ -164,4 +164,4 @@
     9.4  #define cx_foreach(type, elem, iter) \
     9.5  for (type elem; cxIteratorValid(&iter) && (elem = (type)cxIteratorCurrent(&iter)) != NULL ; cxIteratorNext(&iter)) // NOLINT(bugprone-macro-parentheses)
     9.6  
     9.7 -#endif /* UCX_ITERATOR_H */
     9.8 +#endif // UCX_ITERATOR_H
    10.1 --- a/src/cx/linked_list.h	Sun Nov 20 17:48:42 2022 +0100
    10.2 +++ b/src/cx/linked_list.h	Sun Nov 20 21:08:36 2022 +0100
    10.3 @@ -444,7 +444,7 @@
    10.4  ) __attribute__((__nonnull__(1)));
    10.5  
    10.6  #ifdef __cplusplus
    10.7 -} /* extern "C" */
    10.8 +} // extern "C"
    10.9  #endif
   10.10  
   10.11 -#endif /* UCX_LINKED_LIST_H */
   10.12 +#endif // UCX_LINKED_LIST_H
    11.1 --- a/src/cx/list.h	Sun Nov 20 17:48:42 2022 +0100
    11.2 +++ b/src/cx/list.h	Sun Nov 20 21:08:36 2022 +0100
    11.3 @@ -419,7 +419,7 @@
    11.4  void cxListDestroy(CxList *list);
    11.5  
    11.6  #ifdef __cplusplus
    11.7 -} /* extern "C" */
    11.8 +} // extern "C"
    11.9  #endif
   11.10  
   11.11 -#endif /* UCX_LIST_H */
   11.12 +#endif // UCX_LIST_H
    12.1 --- a/src/cx/tree.h	Sun Nov 20 17:48:42 2022 +0100
    12.2 +++ b/src/cx/tree.h	Sun Nov 20 21:08:36 2022 +0100
    12.3 @@ -129,8 +129,8 @@
    12.4  
    12.5  
    12.6  #ifdef __cplusplus
    12.7 -} /* extern "C" */
    12.8 +} // extern "C"
    12.9  #endif
   12.10  
   12.11 -#endif /* UCX_TREE_H */
   12.12 +#endif // UCX_TREE_H
   12.13  
    13.1 --- a/src/cx/utils.h	Sun Nov 20 17:48:42 2022 +0100
    13.2 +++ b/src/cx/utils.h	Sun Nov 20 21:08:36 2022 +0100
    13.3 @@ -51,9 +51,7 @@
    13.4   */
    13.5  #define cx_for_n(varname, n) for (size_t varname = 0 ; (varname) < (n) ; (varname)++)
    13.6  
    13.7 -/* ----------------------
    13.8 - * cx_szmul() definition.
    13.9 - * ---------------------- */
   13.10 +// cx_szmul() definition
   13.11  
   13.12  #if (__GNUC__ >= 5 || defined(__clang__)) && !defined(CX_NO_SZMUL_BUILTIN)
   13.13  #define CX_SZMUL_BUILTIN
   13.14 @@ -72,7 +70,7 @@
   13.15   * otherwise
   13.16   */
   13.17  #define cx_szmul(a, b, result) __builtin_umul_overflow(a, b, result)
   13.18 -#else /* __WORDSIZE != 32 */
   13.19 +#else // __WORDSIZE != 32
   13.20  /**
   13.21   * Alias for \c __builtin_umull_overflow.
   13.22   *
   13.23 @@ -86,9 +84,9 @@
   13.24   * otherwise
   13.25   */
   13.26  #define cx_szmul(a, b, result) __builtin_umull_overflow(a, b, result)
   13.27 -#endif /* __WORDSIZE */
   13.28 +#endif // __WORDSIZE
   13.29  
   13.30 -#else /* no GNUC or clang bultin */
   13.31 +#else // no GNUC or clang bultin
   13.32  
   13.33  /**
   13.34   * Performs a multiplication of size_t values and checks for overflow.
   13.35 @@ -122,4 +120,4 @@
   13.36  }
   13.37  #endif
   13.38  
   13.39 -#endif /* UCX_UTILS_H */
   13.40 +#endif // UCX_UTILS_H
    14.1 --- a/src/hash_key.c	Sun Nov 20 17:48:42 2022 +0100
    14.2 +++ b/src/hash_key.c	Sun Nov 20 21:08:36 2022 +0100
    14.3 @@ -32,7 +32,7 @@
    14.4  void cx_hash_murmur(CxHashKey *key) {
    14.5      unsigned char const *data = key->data.cbytes;
    14.6      if (data == NULL) {
    14.7 -        /* extension: special value for NULL */
    14.8 +        // extension: special value for NULL
    14.9          key->hash = 1574210520u;
   14.10          return;
   14.11      }
   14.12 @@ -70,8 +70,8 @@
   14.13              h ^= (data[i + 0] & 0xFF);
   14.14              h *= m;
   14.15                      __attribute__((__fallthrough__));
   14.16 -        default:
   14.17 -            /* do nothing */;
   14.18 +        default: // do nothing
   14.19 +        ;
   14.20      }
   14.21  
   14.22      h ^= h >> 13;
    15.1 --- a/src/linked_list.c	Sun Nov 20 17:48:42 2022 +0100
    15.2 +++ b/src/linked_list.c	Sun Nov 20 21:08:36 2022 +0100
    15.3 @@ -32,7 +32,7 @@
    15.4  #include <string.h>
    15.5  #include <assert.h>
    15.6  
    15.7 -/* LOW LEVEL LINKED LIST FUNCTIONS */
    15.8 +// LOW LEVEL LINKED LIST FUNCTIONS
    15.9  
   15.10  #define CX_LL_PTR(cur, off) (*(void**)(((char*)(cur))+(off)))
   15.11  #define ll_prev(node) CX_LL_PTR(node, loc_prev)
   15.12 @@ -337,7 +337,7 @@
   15.13      return ret;
   15.14  }
   15.15  
   15.16 -void cx_linked_list_sort( /* NOLINT(misc-no-recursion) - purposely recursive function */
   15.17 +void cx_linked_list_sort( // NOLINT(misc-no-recursion) - purposely recursive function
   15.18          void **begin,
   15.19          void **end,
   15.20          ptrdiff_t loc_prev,
   15.21 @@ -455,7 +455,7 @@
   15.22      *begin = prev;
   15.23  }
   15.24  
   15.25 -/* HIGH LEVEL LINKED LIST IMPLEMENTATION */
   15.26 +// HIGH LEVEL LINKED LIST IMPLEMENTATION
   15.27  
   15.28  typedef struct cx_linked_list_node cx_linked_list_node;
   15.29  struct cx_linked_list_node {
    16.1 --- a/src/list.c	Sun Nov 20 17:48:42 2022 +0100
    16.2 +++ b/src/list.c	Sun Nov 20 21:08:36 2022 +0100
    16.3 @@ -57,10 +57,10 @@
    16.4          CxList const *other
    16.5  ) {
    16.6      if (list->cl->compare == other->cl->compare) {
    16.7 -        /* same compare function, lists are compatible */
    16.8 +        // same compare function, lists are compatible
    16.9          return list->cl->compare(list, other);
   16.10      } else {
   16.11 -        /* different compare functions, use iterator */
   16.12 +        // different compare functions, use iterator
   16.13          if (list->size == other->size) {
   16.14              // TODO: we would need a const iterator
   16.15              CxIterator left = cxListBegin(list);
    17.1 --- a/src/string.c	Sun Nov 20 17:48:42 2022 +0100
    17.2 +++ b/src/string.c	Sun Nov 20 21:08:36 2022 +0100
    17.3 @@ -35,9 +35,9 @@
    17.4  
    17.5  #ifndef _WIN32
    17.6  
    17.7 -#include <strings.h> /* for strncasecmp() */
    17.8 +#include <strings.h> // for strncasecmp()
    17.9  
   17.10 -#endif /* _WIN32 */
   17.11 +#endif // _WIN32
   17.12  
   17.13  cxmutstr cx_mutstr(char *cstring) {
   17.14      return (cxmutstr) {cstring, strlen(cstring)};
   17.15 @@ -236,7 +236,7 @@
   17.16          return haystack;
   17.17      }
   17.18  
   17.19 -    /* optimize for single-char needles */
   17.20 +    // optimize for single-char needles
   17.21      if (needle.length == 1) {
   17.22          return cx_strchr(haystack, *needle.ptr);
   17.23      }
   17.24 @@ -249,19 +249,19 @@
   17.25       * and we want to avoid that.
   17.26       */
   17.27  
   17.28 -    /* local prefix table */
   17.29 +    // local prefix table
   17.30      size_t s_prefix_table[STRSTR_SBO_BUFLEN];
   17.31  
   17.32 -    /* check needle length and use appropriate prefix table */
   17.33 -    /* if the pattern exceeds static prefix table, allocate on the heap */
   17.34 +    // check needle length and use appropriate prefix table
   17.35 +    // if the pattern exceeds static prefix table, allocate on the heap
   17.36      bool useheap = needle.length >= STRSTR_SBO_BUFLEN;
   17.37      register size_t *ptable = useheap ? calloc(needle.length + 1,
   17.38                                                 sizeof(size_t)) : s_prefix_table;
   17.39  
   17.40 -    /* keep counter in registers */
   17.41 +    // keep counter in registers
   17.42      register size_t i, j;
   17.43  
   17.44 -    /* fill prefix table */
   17.45 +    // fill prefix table
   17.46      i = 0;
   17.47      j = 0;
   17.48      ptable[i] = j;
   17.49 @@ -274,7 +274,7 @@
   17.50          ptable[i] = j;
   17.51      }
   17.52  
   17.53 -    /* search */
   17.54 +    // search
   17.55      cxstring result = {NULL, 0};
   17.56      i = 0;
   17.57      j = 1;
   17.58 @@ -292,7 +292,7 @@
   17.59          }
   17.60      }
   17.61  
   17.62 -    /* if prefix table was allocated on the heap, free it */
   17.63 +    // if prefix table was allocated on the heap, free it
   17.64      if (ptable != s_prefix_table) {
   17.65          free(ptable);
   17.66      }
   17.67 @@ -314,23 +314,24 @@
   17.68          size_t limit,
   17.69          cxstring *output
   17.70  ) {
   17.71 -    /* special case: output limit is zero */
   17.72 +    // special case: output limit is zero
   17.73      if (limit == 0) return 0;
   17.74  
   17.75 -    /* special case: delimiter is empty */
   17.76 +    // special case: delimiter is empty
   17.77      if (delim.length == 0) {
   17.78          output[0] = string;
   17.79          return 1;
   17.80      }
   17.81  
   17.82 -    /* special cases: delimiter is at least as large as the string */
   17.83 +    // special cases: delimiter is at least as large as the string
   17.84      if (delim.length >= string.length) {
   17.85 -        /* exact match */
   17.86 +        // exact match
   17.87          if (cx_strcmp(string, delim) == 0) {
   17.88              output[0] = cx_strn(string.ptr, 0);
   17.89              output[1] = cx_strn(string.ptr + string.length, 0);
   17.90              return 2;
   17.91 -        } else /* no match possible */ {
   17.92 +        } else {
   17.93 +            // no match possible
   17.94              output[0] = string;
   17.95              return 1;
   17.96          }
   17.97 @@ -342,21 +343,21 @@
   17.98          ++n;
   17.99          cxstring match = cx_strstr(curpos, delim);
  17.100          if (match.length > 0) {
  17.101 -            /* is the limit reached? */
  17.102 +            // is the limit reached?
  17.103              if (n < limit) {
  17.104 -                /* copy the current string to the array */
  17.105 +                // copy the current string to the array
  17.106                  cxstring item = cx_strn(curpos.ptr, match.ptr - curpos.ptr);
  17.107                  output[n - 1] = item;
  17.108                  size_t processed = item.length + delim.length;
  17.109                  curpos.ptr += processed;
  17.110                  curpos.length -= processed;
  17.111              } else {
  17.112 -                /* limit reached, copy the _full_ remaining string */
  17.113 +                // limit reached, copy the _full_ remaining string
  17.114                  output[n - 1] = curpos;
  17.115                  break;
  17.116              }
  17.117          } else {
  17.118 -            /* no more matches, copy last string */
  17.119 +            // no more matches, copy last string
  17.120              output[n - 1] = curpos;
  17.121              break;
  17.122          }
  17.123 @@ -372,24 +373,24 @@
  17.124          size_t limit,
  17.125          cxstring **output
  17.126  ) {
  17.127 -    /* find out how many splits we're going to make and allocate memory */
  17.128 +    // find out how many splits we're going to make and allocate memory
  17.129      size_t n = 0;
  17.130      cxstring curpos = string;
  17.131      while (1) {
  17.132          ++n;
  17.133          cxstring match = cx_strstr(curpos, delim);
  17.134          if (match.length > 0) {
  17.135 -            /* is the limit reached? */
  17.136 +            // is the limit reached?
  17.137              if (n < limit) {
  17.138                  size_t processed = match.ptr - curpos.ptr + delim.length;
  17.139                  curpos.ptr += processed;
  17.140                  curpos.length -= processed;
  17.141              } else {
  17.142 -                /* limit reached */
  17.143 +                // limit reached
  17.144                  break;
  17.145              }
  17.146          } else {
  17.147 -            /* no more matches */
  17.148 +            // no more matches
  17.149              break;
  17.150          }
  17.151      }
  17.152 @@ -566,14 +567,14 @@
  17.153      if (pattern.length == 0 || pattern.length > str.length || replmax == 0)
  17.154          return cx_strdup_a(allocator, str);
  17.155  
  17.156 -    /* Compute expected buffer length */
  17.157 +    // Compute expected buffer length
  17.158      size_t ibufmax = str.length / pattern.length;
  17.159      size_t ibuflen = replmax < ibufmax ? replmax : ibufmax;
  17.160      if (ibuflen > REPLACE_INDEX_BUFFER_MAX) {
  17.161          ibuflen = REPLACE_INDEX_BUFFER_MAX;
  17.162      }
  17.163  
  17.164 -    /* Allocate first index buffer */
  17.165 +    // Allocate first index buffer
  17.166      struct cx_strreplace_ibuf *firstbuf, *curbuf;
  17.167      firstbuf = curbuf = calloc(1, sizeof(struct cx_strreplace_ibuf));
  17.168      if (!firstbuf) return cx_mutstrn(NULL, 0);
  17.169 @@ -583,13 +584,13 @@
  17.170          return cx_mutstrn(NULL, 0);
  17.171      }
  17.172  
  17.173 -    /* Search occurrences */
  17.174 +    // Search occurrences
  17.175      cxstring searchstr = str;
  17.176      size_t found = 0;
  17.177      do {
  17.178          cxstring match = cx_strstr(searchstr, pattern);
  17.179          if (match.length > 0) {
  17.180 -            /* Allocate next buffer in chain, if required */
  17.181 +            // Allocate next buffer in chain, if required
  17.182              if (curbuf->len == ibuflen) {
  17.183                  struct cx_strreplace_ibuf *nextbuf =
  17.184                          calloc(1, sizeof(struct cx_strreplace_ibuf));
  17.185 @@ -607,7 +608,7 @@
  17.186                  curbuf = nextbuf;
  17.187              }
  17.188  
  17.189 -            /* Record match index */
  17.190 +            // Record match index
  17.191              found++;
  17.192              size_t idx = match.ptr - str.ptr;
  17.193              curbuf->buf[curbuf->len++] = idx;
  17.194 @@ -618,7 +619,7 @@
  17.195          }
  17.196      } while (searchstr.length > 0 && found < replmax);
  17.197  
  17.198 -    /* Allocate result string */
  17.199 +    // Allocate result string
  17.200      cxmutstr result;
  17.201      {
  17.202          ssize_t adjlen = (ssize_t) replacement.length - (ssize_t) pattern.length;
  17.203 @@ -636,13 +637,13 @@
  17.204          }
  17.205      }
  17.206  
  17.207 -    /* Build result string */
  17.208 +    // Build result string
  17.209      curbuf = firstbuf;
  17.210      size_t srcidx = 0;
  17.211      char *destptr = result.ptr;
  17.212      do {
  17.213          for (size_t i = 0; i < curbuf->len; i++) {
  17.214 -            /* Copy source part up to next match*/
  17.215 +            // Copy source part up to next match
  17.216              size_t idx = curbuf->buf[i];
  17.217              size_t srclen = idx - srcidx;
  17.218              if (srclen > 0) {
  17.219 @@ -651,7 +652,7 @@
  17.220                  srcidx += srclen;
  17.221              }
  17.222  
  17.223 -            /* Copy the replacement and skip the source pattern */
  17.224 +            // Copy the replacement and skip the source pattern
  17.225              srcidx += pattern.length;
  17.226              memcpy(destptr, replacement.ptr, replacement.length);
  17.227              destptr += replacement.length;
  17.228 @@ -660,10 +661,10 @@
  17.229      } while (curbuf);
  17.230      memcpy(destptr, str.ptr + srcidx, str.length - srcidx);
  17.231  
  17.232 -    /* Result is guaranteed to be zero-terminated */
  17.233 +    // Result is guaranteed to be zero-terminated
  17.234      result.ptr[result.length] = '\0';
  17.235  
  17.236 -    /* Free index buffer */
  17.237 +    // Free index buffer
  17.238      cx_strrepl_free_ibuf(firstbuf);
  17.239  
  17.240      return result;
    18.1 --- a/test/test_string.cpp	Sun Nov 20 17:48:42 2022 +0100
    18.2 +++ b/test/test_string.cpp	Sun Nov 20 21:08:36 2022 +0100
    18.3 @@ -272,22 +272,22 @@
    18.4      cxstring list[8];
    18.5      size_t n;
    18.6  
    18.7 -    /* special case: empty string */
    18.8 +    // special case: empty string
    18.9      n = cx_strsplit(test, cx_str(""), capa, list);
   18.10      ASSERT_EQ(n, 1);
   18.11      EXPECT_EQ(cx_strcmp(list[0], test), 0);
   18.12  
   18.13 -    /* no delimiter occurrence */
   18.14 +    // no delimiter occurrence
   18.15      n = cx_strsplit(test, cx_str("z"), capa, list);
   18.16      ASSERT_EQ(n, 1);
   18.17      EXPECT_EQ(cx_strcmp(list[0], test), 0);
   18.18  
   18.19 -    /* partially matching delimiter */
   18.20 +    // partially matching delimiter
   18.21      n = cx_strsplit(test, cx_str("is,not"), capa, list);
   18.22      ASSERT_EQ(n, 1);
   18.23      EXPECT_EQ(cx_strcmp(list[0], test), 0);
   18.24  
   18.25 -    /* matching single-char delimiter */
   18.26 +    // matching single-char delimiter
   18.27      n = cx_strsplit(test, cx_str(","), capa, list);
   18.28      ASSERT_EQ(n, 5);
   18.29      EXPECT_EQ(cx_strcmp(list[0], cx_str("this")), 0);
   18.30 @@ -296,65 +296,65 @@
   18.31      EXPECT_EQ(cx_strcmp(list[3], cx_str("csv")), 0);
   18.32      EXPECT_EQ(cx_strcmp(list[4], cx_str("string")), 0);
   18.33  
   18.34 -    /* matching multi-char delimiter */
   18.35 +    // matching multi-char delimiter
   18.36      n = cx_strsplit(test, cx_str("is"), capa, list);
   18.37      ASSERT_EQ(n, 3);
   18.38      EXPECT_EQ(cx_strcmp(list[0], cx_str("th")), 0);
   18.39      EXPECT_EQ(cx_strcmp(list[1], cx_str(",")), 0);
   18.40      EXPECT_EQ(cx_strcmp(list[2], cx_str(",a,csv,string")), 0);
   18.41  
   18.42 -    /* bounded list using single-char delimiter */
   18.43 +    // bounded list using single-char delimiter
   18.44      n = cx_strsplit(test, cx_str(","), 3, list);
   18.45      ASSERT_EQ(n, 3);
   18.46      EXPECT_EQ(cx_strcmp(list[0], cx_str("this")), 0);
   18.47      EXPECT_EQ(cx_strcmp(list[1], cx_str("is")), 0);
   18.48      EXPECT_EQ(cx_strcmp(list[2], cx_str("a,csv,string")), 0);
   18.49  
   18.50 -    /* bounded list using multi-char delimiter */
   18.51 +    // bounded list using multi-char delimiter
   18.52      n = cx_strsplit(test, cx_str("is"), 2, list);
   18.53      ASSERT_EQ(n, 2);
   18.54      EXPECT_EQ(cx_strcmp(list[0], cx_str("th")), 0);
   18.55      EXPECT_EQ(cx_strcmp(list[1], cx_str(",is,a,csv,string")), 0);
   18.56  
   18.57 -    /* start with delimiter */
   18.58 +    // start with delimiter
   18.59      n = cx_strsplit(test, cx_str("this"), capa, list);
   18.60      ASSERT_EQ(n, 2);
   18.61      EXPECT_EQ(cx_strcmp(list[0], cx_str("")), 0);
   18.62      EXPECT_EQ(cx_strcmp(list[1], cx_str(",is,a,csv,string")), 0);
   18.63  
   18.64 -    /* end with delimiter */
   18.65 +    // end with delimiter
   18.66      n = cx_strsplit(test, cx_str("string"), capa, list);
   18.67      ASSERT_EQ(n, 2);
   18.68      EXPECT_EQ(cx_strcmp(list[0], cx_str("this,is,a,csv,")), 0);
   18.69      EXPECT_EQ(cx_strcmp(list[1], cx_str("")), 0);
   18.70  
   18.71  
   18.72 -    /* end with delimiter exceed bound */
   18.73 +    // end with delimiter exceed bound
   18.74      n = cx_strsplit(cx_str("a,b,c,"), cx_str(","), 3, list);
   18.75      ASSERT_EQ(n, 3);
   18.76      EXPECT_EQ(cx_strcmp(list[0], cx_str("a")), 0);
   18.77      EXPECT_EQ(cx_strcmp(list[1], cx_str("b")), 0);
   18.78      EXPECT_EQ(cx_strcmp(list[2], cx_str("c,")), 0);
   18.79  
   18.80 -    /* exact match */
   18.81 +    // exact match
   18.82      n = cx_strsplit(test, cx_str("this,is,a,csv,string"), capa, list);
   18.83      ASSERT_EQ(n, 2);
   18.84      EXPECT_EQ(cx_strcmp(list[0], cx_str("")), 0);
   18.85      EXPECT_EQ(cx_strcmp(list[1], cx_str("")), 0);
   18.86  
   18.87 -    /* string to be split is only substring */
   18.88 +    // string to be split is only substring
   18.89      n = cx_strsplit(test, cx_str("this,is,a,csv,string,with,extension"), capa, list);
   18.90      ASSERT_EQ(n, 1);
   18.91      EXPECT_EQ(cx_strcmp(list[0], test), 0);
   18.92  
   18.93 -    /* subsequent encounter of delimiter (the string between is empty) */
   18.94 +    // subsequent encounter of delimiter (the string between is empty)
   18.95      n = cx_strsplit(test, cx_str("is,"), capa, list);
   18.96      ASSERT_EQ(n, 3);
   18.97      EXPECT_EQ(cx_strcmp(list[0], cx_str("th")), 0);
   18.98      EXPECT_EQ(cx_strcmp(list[1], cx_str("")), 0);
   18.99      EXPECT_EQ(cx_strcmp(list[2], cx_str("a,csv,string")), 0);
  18.100  
  18.101 -    /* call the _m variant just for coverage */
  18.102 +    // call the _m variant just for coverage
  18.103      auto mtest = cx_strdup(test);
  18.104      cxmutstr mlist[4];
  18.105      n = cx_strsplit_m(mtest, cx_str("is,"), 4, mlist);
  18.106 @@ -373,25 +373,25 @@
  18.107      cxstring *list;
  18.108      size_t n;
  18.109  
  18.110 -    /* special case: empty string */
  18.111 +    // special case: empty string
  18.112      n = cx_strsplit_a(&alloc, test, cx_str(""), capa, &list);
  18.113      ASSERT_EQ(n, 1);
  18.114      EXPECT_EQ(cx_strcmp(list[0], test), 0);
  18.115      cxFree(&alloc, list);
  18.116  
  18.117 -    /* no delimiter occurrence */
  18.118 +    // no delimiter occurrence
  18.119      n = cx_strsplit_a(&alloc, test, cx_str("z"), capa, &list);
  18.120      ASSERT_EQ(n, 1);
  18.121      EXPECT_EQ(cx_strcmp(list[0], test), 0);
  18.122      cxFree(&alloc, list);
  18.123  
  18.124 -    /* partially matching delimiter */
  18.125 +    // partially matching delimiter
  18.126      n = cx_strsplit_a(&alloc, test, cx_str("is,not"), capa, &list);
  18.127      ASSERT_EQ(n, 1);
  18.128      EXPECT_EQ(cx_strcmp(list[0], test), 0);
  18.129      cxFree(&alloc, list);
  18.130  
  18.131 -    /* matching single-char delimiter */
  18.132 +    // matching single-char delimiter
  18.133      n = cx_strsplit_a(&alloc, test, cx_str(","), capa, &list);
  18.134      ASSERT_EQ(n, 5);
  18.135      EXPECT_EQ(cx_strcmp(list[0], cx_str("this")), 0);
  18.136 @@ -401,7 +401,7 @@
  18.137      EXPECT_EQ(cx_strcmp(list[4], cx_str("string")), 0);
  18.138      cxFree(&alloc, list);
  18.139  
  18.140 -    /* matching multi-char delimiter */
  18.141 +    // matching multi-char delimiter
  18.142      n = cx_strsplit_a(&alloc, test, cx_str("is"), capa, &list);
  18.143      ASSERT_EQ(n, 3);
  18.144      EXPECT_EQ(cx_strcmp(list[0], cx_str("th")), 0);
  18.145 @@ -409,7 +409,7 @@
  18.146      EXPECT_EQ(cx_strcmp(list[2], cx_str(",a,csv,string")), 0);
  18.147      cxFree(&alloc, list);
  18.148  
  18.149 -    /* bounded list using single-char delimiter */
  18.150 +    // bounded list using single-char delimiter
  18.151      n = cx_strsplit_a(&alloc, test, cx_str(","), 3, &list);
  18.152      ASSERT_EQ(n, 3);
  18.153      EXPECT_EQ(cx_strcmp(list[0], cx_str("this")), 0);
  18.154 @@ -417,28 +417,28 @@
  18.155      EXPECT_EQ(cx_strcmp(list[2], cx_str("a,csv,string")), 0);
  18.156      cxFree(&alloc, list);
  18.157  
  18.158 -    /* bounded list using multi-char delimiter */
  18.159 +    // bounded list using multi-char delimiter
  18.160      n = cx_strsplit_a(&alloc, test, cx_str("is"), 2, &list);
  18.161      ASSERT_EQ(n, 2);
  18.162      EXPECT_EQ(cx_strcmp(list[0], cx_str("th")), 0);
  18.163      EXPECT_EQ(cx_strcmp(list[1], cx_str(",is,a,csv,string")), 0);
  18.164      cxFree(&alloc, list);
  18.165  
  18.166 -    /* start with delimiter */
  18.167 +    // start with delimiter
  18.168      n = cx_strsplit_a(&alloc, test, cx_str("this"), capa, &list);
  18.169      ASSERT_EQ(n, 2);
  18.170      EXPECT_EQ(cx_strcmp(list[0], cx_str("")), 0);
  18.171      EXPECT_EQ(cx_strcmp(list[1], cx_str(",is,a,csv,string")), 0);
  18.172      cxFree(&alloc, list);
  18.173  
  18.174 -    /* end with delimiter */
  18.175 +    // end with delimiter
  18.176      n = cx_strsplit_a(&alloc, test, cx_str("string"), capa, &list);
  18.177      ASSERT_EQ(n, 2);
  18.178      EXPECT_EQ(cx_strcmp(list[0], cx_str("this,is,a,csv,")), 0);
  18.179      EXPECT_EQ(cx_strcmp(list[1], cx_str("")), 0);
  18.180      cxFree(&alloc, list);
  18.181  
  18.182 -    /* end with delimiter exceed bound */
  18.183 +    // end with delimiter exceed bound
  18.184      n = cx_strsplit_a(&alloc, cx_str("a,b,c,"), cx_str(","), 3, &list);
  18.185      ASSERT_EQ(n, 3);
  18.186      EXPECT_EQ(cx_strcmp(list[0], cx_str("a")), 0);
  18.187 @@ -446,20 +446,20 @@
  18.188      EXPECT_EQ(cx_strcmp(list[2], cx_str("c,")), 0);
  18.189      cxFree(&alloc, list);
  18.190  
  18.191 -    /* exact match */
  18.192 +    // exact match
  18.193      n = cx_strsplit_a(&alloc, test, cx_str("this,is,a,csv,string"), capa, &list);
  18.194      ASSERT_EQ(n, 2);
  18.195      EXPECT_EQ(cx_strcmp(list[0], cx_str("")), 0);
  18.196      EXPECT_EQ(cx_strcmp(list[1], cx_str("")), 0);
  18.197      cxFree(&alloc, list);
  18.198  
  18.199 -    /* string to be split is only substring */
  18.200 +    // string to be split is only substring
  18.201      n = cx_strsplit_a(&alloc, test, cx_str("this,is,a,csv,string,with,extension"), capa, &list);
  18.202      ASSERT_EQ(n, 1);
  18.203      EXPECT_EQ(cx_strcmp(list[0], test), 0);
  18.204      cxFree(&alloc, list);
  18.205  
  18.206 -    /* subsequent encounter of delimiter (the string between is empty) */
  18.207 +    // subsequent encounter of delimiter (the string between is empty)
  18.208      n = cx_strsplit_a(&alloc, test, cx_str("is,"), capa, &list);
  18.209      ASSERT_EQ(n, 3);
  18.210      EXPECT_EQ(cx_strcmp(list[0], cx_str("th")), 0);
  18.211 @@ -467,7 +467,7 @@
  18.212      EXPECT_EQ(cx_strcmp(list[2], cx_str("a,csv,string")), 0);
  18.213      cxFree(&alloc, list);
  18.214  
  18.215 -    /* call the _m variant just for coverage */
  18.216 +    // call the _m variant just for coverage
  18.217      auto mtest = cx_strdup(test);
  18.218      cxmutstr *mlist;
  18.219      n = cx_strsplit_ma(&alloc, mtest, cx_str("is,"), 4, &mlist);
  18.220 @@ -496,7 +496,7 @@
  18.221      EXPECT_EQ(cx_strcmp(t5, cx_str("")), 0);
  18.222      EXPECT_EQ(cx_strcmp(empty, cx_str("")), 0);
  18.223  
  18.224 -    /* call the _m variant just for coverage */
  18.225 +    // call the _m variant just for coverage
  18.226      cxmutstr m1 = cx_strtrim_m(cx_mutstr((char *) "  ein test  \t "));
  18.227      EXPECT_EQ(cx_strcmp(cx_strcast(m1), cx_str("ein test")), 0);
  18.228  }
    19.1 --- a/test/util_allocator.h	Sun Nov 20 17:48:42 2022 +0100
    19.2 +++ b/test/util_allocator.h	Sun Nov 20 21:08:36 2022 +0100
    19.3 @@ -78,4 +78,4 @@
    19.4      [[nodiscard]] bool verify() const;
    19.5  };
    19.6  
    19.7 -#endif /* UCX_UTIL_ALLOCATOR_H */
    19.8 +#endif // UCX_UTIL_ALLOCATOR_H

mercurial