MCPcopy Create free account
hub / github.com/acl-dev/acl / test_string

Function test_string

lib_acl/samples/mmap_string/main.c:36–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34}
35
36static void test_string(ACL_FILE_HANDLE fd, ssize_t max, int debug)
37{
38 ACL_VSTRING *vp = acl_vstring_mmap_alloc(fd, 1, max);
39 const char *s = "hello world!";
40
41 printf("-------------------------------------------------------\r\n");
42 incr_string(vp, max - 1, NULL, debug);
43
44 printf("-------------------------------------------------------\r\n");
45 incr_string(vp, max - 1 - strlen(s), s, debug);
46
47 printf("-------------------------------------------------------\r\n");
48 incr_string(vp, max, NULL, debug);
49
50 printf("-------------------------------------------------------\r\n");
51 incr_string(vp, max + 2, NULL, debug);
52
53 printf("-------------------------------------------------------\r\n");
54 acl_vstring_strcat(vp, s);
55 incr_string(vp, max - strlen(s) - 1, NULL, debug);
56
57 printf("-------------------------------------------------------\r\n");
58 acl_vstring_strcat(vp, s);
59 incr_string(vp, max, NULL, debug);
60
61 printf("-------------------------------------------------------\r\n");
62 acl_vstring_strcat(vp, s);
63 incr_string(vp, max + 10, NULL, debug);
64
65 printf(">>>[%s]\r\n", acl_vstring_str(vp));
66 printf(">>>len: %ld, %ld, %p, %p\r\n",
67 (long) strlen(acl_vstring_str(vp)),
68 (long) ACL_VSTRING_LEN(vp),
69 acl_vstring_str(vp), acl_vstring_end(vp));
70 acl_vstring_free(vp);
71}
72
73static void usage(const char* procname)
74{

Callers 1

mainFunction · 0.85

Calls 4

acl_vstring_mmap_allocFunction · 0.85
incr_stringFunction · 0.85
acl_vstring_strcatFunction · 0.85
acl_vstring_freeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…