diff -r 0811fb9a8dba -r 0597f1f20ea9 docs/Writerside/topics/map.h.md --- a/docs/Writerside/topics/map.h.md Wed Apr 16 20:35:34 2025 +0200 +++ b/docs/Writerside/topics/map.h.md Thu Apr 17 20:47:43 2025 +0200 @@ -67,7 +67,7 @@ cx_foreach(CxMapEntry *, entry, iter) { cxstring name = cx_strn(entry->key->data, entry->key->len); const char *phone = entry->value; - printf("%.*s: %s\n", (int) name.length, name.ptr, phone); + printf("%" CX_PRIstr ": %s\n", CX_SFMT(name), phone); } cxMapFree(contacts); @@ -82,7 +82,7 @@ Then the example shows retrieval, updating, and removal of information. The last part shows how to iterate over the pairs of the map and how to recover the string from the key. -In real world situations, however, it is quite unlikely that you will use a map to store string literals. +In real-world situations, however, it is quite unlikely that you will use a map to store string literals. The next example shows a more realistic program, where it is necessary to store strings based on user input. ```C @@ -142,8 +142,8 @@ if (phone == NULL) { puts("No record."); } else { - printf("Result: %.*s\n", - (int) phone->length, phone->ptr); + printf("Result: %" CX_PRIstr "\n", + CX_SFMT(*phone)); } } } else if (input[0] == '3') { @@ -167,9 +167,8 @@ entry->key->len); // ... except that here we get cxmutstr* cxmutstr *phone = entry->value; - printf("%.*s: %.*s\n", - (int) name.length, name.ptr, - (int) phone->length, phone->ptr); + printf("%" CX_PRIstr ": %" CX_PRIstr "\n", + CX_SFMT(name), CX_SFMT(*phone)); } } else if (input[0] == '0') { running = false;