util  Diff

Differences From Artifact [d981619adf]:

To Artifact [5d94fe752b]:


    18     18   
    19     19   #include <string.h>
    20     20   
    21     21   typedef struct pstr { size_t len; union {
    22     22   	const char* ptr;
    23     23   	char* mutptr;
    24     24   }; } pstr;
    25         -#define _p(str) { sizeof str - 1, str }
           25  +#define _p(str) { sizeof (str) - 1, (str) }
    26     26   
    27     27   typedef struct safestr {
    28     28   	union {
    29     29   		const char* ptr;
    30     30   		char* mutptr;
    31     31   	}; // im sorry okay
    32     32   #	ifndef k_static
................................................................................
    55     55   	for (size_t i = 0; i < ct; ++i) {
    56     56   		if (lst[i].len == 0) {
    57     57   			if (lst[i].ptr == NULL) continue;
    58     58   			lst[i].len = strlen(lst[i].ptr);
    59     59   		}
    60     60   		len += lst[i].len;
    61     61   	}
           62  +	return len;
    62     63   })
    63     64   
    64     65   char* pstrcoll(pstr* lst, size_t ct, char* ptr) fn({
    65     66   	for (size_t i = 0; i < ct; ++i) {
    66     67   		if (lst[i].len == 0) continue;
    67     68   		strncpy(ptr,lst[i].ptr,lst[i].len);
    68     69   		ptr += lst[i].len;