util  Diff

Differences From Artifact [d981619adf]:

To Artifact [5d94fe752b]:


18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
..
55
56
57
58
59
60
61

62
63
64
65
66
67
68

#include <string.h>

typedef struct pstr { size_t len; union {
	const char* ptr;
	char* mutptr;
}; } pstr;
#define _p(str) { sizeof str - 1, str }

typedef struct safestr {
	union {
		const char* ptr;
		char* mutptr;
	}; // im sorry okay
#	ifndef k_static
................................................................................
	for (size_t i = 0; i < ct; ++i) {
		if (lst[i].len == 0) {
			if (lst[i].ptr == NULL) continue;
			lst[i].len = strlen(lst[i].ptr);
		}
		len += lst[i].len;
	}

})

char* pstrcoll(pstr* lst, size_t ct, char* ptr) fn({
	for (size_t i = 0; i < ct; ++i) {
		if (lst[i].len == 0) continue;
		strncpy(ptr,lst[i].ptr,lst[i].len);
		ptr += lst[i].len;







|







 







>







18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
..
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69

#include <string.h>

typedef struct pstr { size_t len; union {
	const char* ptr;
	char* mutptr;
}; } pstr;
#define _p(str) { sizeof (str) - 1, (str) }

typedef struct safestr {
	union {
		const char* ptr;
		char* mutptr;
	}; // im sorry okay
#	ifndef k_static
................................................................................
	for (size_t i = 0; i < ct; ++i) {
		if (lst[i].len == 0) {
			if (lst[i].ptr == NULL) continue;
			lst[i].len = strlen(lst[i].ptr);
		}
		len += lst[i].len;
	}
	return len;
})

char* pstrcoll(pstr* lst, size_t ct, char* ptr) fn({
	for (size_t i = 0; i < ct; ++i) {
		if (lst[i].len == 0) continue;
		strncpy(ptr,lst[i].ptr,lst[i].len);
		ptr += lst[i].len;