Changes in / [240b2e4:62e3411] in mainline
- Files:
-
- 3 added
- 6 deleted
- 6 edited
-
abi/include/_bits/mbstate_t.h (deleted)
-
abi/include/_bits/uchar.h (modified) (1 diff)
-
common/include/uchar.h (deleted)
-
common/include/wchar.h (deleted)
-
common/stdc/uchar.c (deleted)
-
common/stdc/wchar.c (deleted)
-
common/str.c (modified) (33 diffs)
-
kernel/generic/include/assert.h (modified) (1 diff)
-
kernel/generic/include/uchar.h (added)
-
uspace/lib/c/include/uchar.h (added)
-
uspace/lib/c/include/wchar.h (added)
-
uspace/lib/c/meson.build (modified) (4 diffs)
-
uspace/lib/c/test/main.c (modified) (1 diff)
-
uspace/lib/c/test/uchar.c (deleted)
-
uspace/lib/ext4/src/extent.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
abi/include/_bits/uchar.h
r240b2e4 r62e3411 46 46 #endif 47 47 48 typedef uint_least16_t char16_t; 49 typedef uint_least32_t char32_t; 48 typedef uint32_t char32_t; 50 49 51 50 #endif -
common/str.c
r240b2e4 r62e3411 54 54 * are valid 55 55 * 56 * Note that Unicode characters do not match57 * one-to-one with displayed characters or glyphs on58 * screen. For that level of precision, look up59 * Grapheme Clusters.60 *61 56 * ASCII character 7 bit encoded ASCII character, stored in char 62 57 * (usually signed 8 bit integer), code points 0 .. 127 … … 76 71 * [wide] string width number of display cells on a monospace display taken 77 72 * by a [wide] string, size_t 78 *79 * This is virtually impossible to determine exactly for80 * all strings without knowing specifics of the display81 * device, due to various factors affecting text output.82 * If you have the option to query the terminal for83 * position change caused by outputting the string,84 * it is preferrable to determine width that way.85 73 * 86 74 * … … 120 108 #include <str.h> 121 109 122 #include <align.h>123 110 #include <assert.h> 124 111 #include <ctype.h> 125 112 #include <errno.h> 126 #include <macros.h>127 #include <mem.h>128 113 #include <stdbool.h> 129 114 #include <stddef.h> 130 115 #include <stdint.h> 131 116 #include <stdlib.h> 132 #include <uchar.h> 117 118 #include <align.h> 119 #include <mem.h> 133 120 134 121 /** Byte mask consisting of lowest @n bits (out of 8) */ … … 143 130 /** Number of data bits in a UTF-8 continuation byte */ 144 131 #define CONT_BITS 6 145 146 static inline bool _is_ascii(uint8_t b)147 {148 return b < 0x80;149 }150 151 static inline bool _is_continuation_byte(uint8_t b)152 {153 return (b & 0xc0) == 0x80;154 }155 156 static inline int _char_continuation_bytes(char32_t c)157 {158 if ((c & ~LO_MASK_32(11)) == 0)159 return 1;160 161 if ((c & ~LO_MASK_32(16)) == 0)162 return 2;163 164 if ((c & ~LO_MASK_32(21)) == 0)165 return 3;166 167 /* Codes longer than 21 bits are not supported */168 return -1;169 }170 171 static inline int _continuation_bytes(uint8_t b)172 {173 /* 0xxxxxxx */174 if (_is_ascii(b))175 return 0;176 177 /* 110xxxxx 10xxxxxx */178 if ((b & 0xe0) == 0xc0)179 return 1;180 181 /* 1110xxxx 10xxxxxx 10xxxxxx */182 if ((b & 0xf0) == 0xe0)183 return 2;184 185 /* 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx */186 if ((b & 0xf8) == 0xf0)187 return 3;188 189 return -1;190 }191 132 192 133 /** Decode a single character from a string. … … 213 154 uint8_t b0 = (uint8_t) str[(*offset)++]; 214 155 215 /* Fast exit for the most common case. */ 216 if (_is_ascii(b0)) 217 return b0; 218 219 /* 10xxxxxx -- unexpected continuation byte */ 220 if (_is_continuation_byte(b0)) 156 /* Determine code length */ 157 158 unsigned int b0_bits; /* Data bits in first byte */ 159 unsigned int cbytes; /* Number of continuation bytes */ 160 161 if ((b0 & 0x80) == 0) { 162 /* 0xxxxxxx (Plain ASCII) */ 163 b0_bits = 7; 164 cbytes = 0; 165 } else if ((b0 & 0xe0) == 0xc0) { 166 /* 110xxxxx 10xxxxxx */ 167 b0_bits = 5; 168 cbytes = 1; 169 } else if ((b0 & 0xf0) == 0xe0) { 170 /* 1110xxxx 10xxxxxx 10xxxxxx */ 171 b0_bits = 4; 172 cbytes = 2; 173 } else if ((b0 & 0xf8) == 0xf0) { 174 /* 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx */ 175 b0_bits = 3; 176 cbytes = 3; 177 } else { 178 /* 10xxxxxx -- unexpected continuation byte */ 221 179 return U_SPECIAL; 222 223 /* Determine code length */ 224 225 unsigned int cbytes = _continuation_bytes(b0); 226 unsigned int b0_bits = 6 - cbytes; /* Data bits in first byte */ 180 } 227 181 228 182 if (*offset + cbytes > size) … … 235 189 uint8_t b = (uint8_t) str[(*offset)++]; 236 190 237 if (!_is_continuation_byte(b)) 191 /* Must be 10xxxxxx */ 192 if ((b & 0xc0) != 0x80) 238 193 return U_SPECIAL; 239 194 … … 266 221 return 0; 267 222 268 int cbytes= 0;223 size_t processed = 0; 269 224 /* Continue while continuation bytes found */ 270 while (*offset > 0 && cbytes< 4) {225 while (*offset > 0 && processed < 4) { 271 226 uint8_t b = (uint8_t) str[--(*offset)]; 272 227 273 if (_is_continuation_byte(b)) { 274 cbytes++; 275 continue; 228 if (processed == 0 && (b & 0x80) == 0) { 229 /* 0xxxxxxx (Plain ASCII) */ 230 return b & 0x7f; 231 } else if ((b & 0xe0) == 0xc0 || (b & 0xf0) == 0xe0 || 232 (b & 0xf8) == 0xf0) { 233 /* Start byte */ 234 size_t start_offset = *offset; 235 return str_decode(str, &start_offset, size); 236 } else if ((b & 0xc0) != 0x80) { 237 /* Not a continuation byte */ 238 return U_SPECIAL; 276 239 } 277 278 /* Invalid byte. */ 279 if (cbytes != _continuation_bytes(b)) 280 return U_SPECIAL; 281 282 /* Start byte */ 283 size_t start_offset = *offset; 284 return str_decode(str, &start_offset, size); 285 } 286 240 processed++; 241 } 287 242 /* Too many continuation bytes */ 288 243 return U_SPECIAL; … … 304 259 * code was invalid. 305 260 */ 306 errno_t chr_encode(c har32_t ch, char *str, size_t *offset, size_t size)261 errno_t chr_encode(const char32_t ch, char *str, size_t *offset, size_t size) 307 262 { 308 263 if (*offset >= size) 309 264 return EOVERFLOW; 310 265 311 /* Fast exit for the most common case. */312 if (ch < 0x80) {313 str[(*offset)++] = (char) ch;314 return EOK;315 }316 317 /* Codes longer than 21 bits are not supported */318 266 if (!chr_check(ch)) 319 267 return EINVAL; 320 268 269 /* 270 * Unsigned version of ch (bit operations should only be done 271 * on unsigned types). 272 */ 273 uint32_t cc = (uint32_t) ch; 274 321 275 /* Determine how many continuation bytes are needed */ 322 276 323 unsigned int cbytes = _char_continuation_bytes(ch); 324 unsigned int b0_bits = 6 - cbytes; /* Data bits in first byte */ 277 unsigned int b0_bits; /* Data bits in first byte */ 278 unsigned int cbytes; /* Number of continuation bytes */ 279 280 if ((cc & ~LO_MASK_32(7)) == 0) { 281 b0_bits = 7; 282 cbytes = 0; 283 } else if ((cc & ~LO_MASK_32(11)) == 0) { 284 b0_bits = 5; 285 cbytes = 1; 286 } else if ((cc & ~LO_MASK_32(16)) == 0) { 287 b0_bits = 4; 288 cbytes = 2; 289 } else if ((cc & ~LO_MASK_32(21)) == 0) { 290 b0_bits = 3; 291 cbytes = 3; 292 } else { 293 /* Codes longer than 21 bits are not supported */ 294 return EINVAL; 295 } 325 296 326 297 /* Check for available space in buffer */ … … 331 302 unsigned int i; 332 303 for (i = cbytes; i > 0; i--) { 333 str[*offset + i] = 0x80 | (c h& LO_MASK_32(CONT_BITS));334 c h >>=CONT_BITS;304 str[*offset + i] = 0x80 | (cc & LO_MASK_32(CONT_BITS)); 305 cc = cc >> CONT_BITS; 335 306 } 336 307 337 308 /* Encode first byte */ 338 str[*offset] = (c h& LO_MASK_32(b0_bits)) | HI_MASK_8(8 - b0_bits - 1);309 str[*offset] = (cc & LO_MASK_32(b0_bits)) | HI_MASK_8(8 - b0_bits - 1); 339 310 340 311 /* Advance offset */ … … 344 315 } 345 316 346 /* Convert in place any bytes that don't form a valid character into U_SPECIAL. */ 347 static void _repair_string(char *str, size_t n) 348 { 349 for (; *str && n > 0; str++, n--) { 350 int cont = _continuation_bytes(*str); 351 if (cont == 0) 352 continue; 353 354 if (cont < 0 || n <= (size_t) cont) { 355 *str = U_SPECIAL; 356 continue; 357 } 358 359 for (int i = 1; i <= cont; i++) { 360 if (!_is_continuation_byte(str[i])) { 361 *str = U_SPECIAL; 362 continue; 363 } 364 } 365 } 366 } 367 368 static size_t _str_size(const char *str) 317 /** Get size of string. 318 * 319 * Get the number of bytes which are used by the string @a str (excluding the 320 * NULL-terminator). 321 * 322 * @param str String to consider. 323 * 324 * @return Number of bytes used by the string 325 * 326 */ 327 size_t str_size(const char *str) 369 328 { 370 329 size_t size = 0; … … 374 333 375 334 return size; 376 }377 378 /** Get size of string.379 *380 * Get the number of bytes which are used by the string @a str (excluding the381 * NULL-terminator).382 *383 * @param str String to consider.384 *385 * @return Number of bytes used by the string386 *387 */388 size_t str_size(const char *str)389 {390 return _str_size(str);391 335 } 392 336 … … 434 378 } 435 379 436 static size_t _str_nsize(const char *str, size_t max_size) 380 /** Get size of string with size limit. 381 * 382 * Get the number of bytes which are used by the string @a str 383 * (excluding the NULL-terminator), but no more than @max_size bytes. 384 * 385 * @param str String to consider. 386 * @param max_size Maximum number of bytes to measure. 387 * 388 * @return Number of bytes used by the string 389 * 390 */ 391 size_t str_nsize(const char *str, size_t max_size) 437 392 { 438 393 size_t size = 0; … … 442 397 443 398 return size; 444 }445 446 /** Get size of string with size limit.447 *448 * Get the number of bytes which are used by the string @a str449 * (excluding the NULL-terminator), but no more than @max_size bytes.450 *451 * @param str String to consider.452 * @param max_size Maximum number of bytes to measure.453 *454 * @return Number of bytes used by the string455 *456 */457 size_t str_nsize(const char *str, size_t max_size)458 {459 return _str_nsize(str, max_size);460 399 } 461 400 … … 643 582 int str_cmp(const char *s1, const char *s2) 644 583 { 645 /* 646 * UTF-8 has the nice property that lexicographic ordering on bytes is 647 * the same as the lexicographic ordering of the character sequences. 648 */ 649 while (*s1 == *s2 && *s1 != 0) { 650 s1++; 651 s2++; 652 } 653 654 if (*s1 == *s2) 655 return 0; 656 657 return (*s1 < *s2) ? -1 : 1; 584 char32_t c1 = 0; 585 char32_t c2 = 0; 586 587 size_t off1 = 0; 588 size_t off2 = 0; 589 590 while (true) { 591 c1 = str_decode(s1, &off1, STR_NO_LIMIT); 592 c2 = str_decode(s2, &off2, STR_NO_LIMIT); 593 594 if (c1 < c2) 595 return -1; 596 597 if (c1 > c2) 598 return 1; 599 600 if (c1 == 0 || c2 == 0) 601 break; 602 } 603 604 return 0; 658 605 } 659 606 … … 734 681 int str_casecmp(const char *s1, const char *s2) 735 682 { 736 // FIXME: doesn't work for non-ASCII caseful characters737 738 683 char32_t c1 = 0; 739 684 char32_t c2 = 0; … … 784 729 int str_lcasecmp(const char *s1, const char *s2, size_t max_len) 785 730 { 786 // FIXME: doesn't work for non-ASCII caseful characters787 788 731 char32_t c1 = 0; 789 732 char32_t c2 = 0; … … 817 760 } 818 761 819 static bool _test_prefix(const char *s, const char *p)820 {821 while (*s == *p && *s != 0) {822 s++;823 p++;824 }825 826 return *p == 0;827 }828 829 762 /** Test whether p is a prefix of s. 830 763 * … … 840 773 bool str_test_prefix(const char *s, const char *p) 841 774 { 842 return _test_prefix(s, p); 775 char32_t c1 = 0; 776 char32_t c2 = 0; 777 778 size_t off1 = 0; 779 size_t off2 = 0; 780 781 while (true) { 782 c1 = str_decode(s, &off1, STR_NO_LIMIT); 783 c2 = str_decode(p, &off2, STR_NO_LIMIT); 784 785 if (c2 == 0) 786 return true; 787 788 if (c1 != c2) 789 return false; 790 791 if (c1 == 0) 792 break; 793 } 794 795 return false; 843 796 } 844 797 … … 867 820 868 821 return s + off; 869 }870 871 /** Copy string as a sequence of bytes. */872 static void _str_cpy(char *dest, const char *src)873 {874 while (*src)875 *(dest++) = *(src++);876 877 *dest = 0;878 }879 880 /** Copy string as a sequence of bytes. */881 static void _str_cpyn(char *dest, size_t size, const char *src)882 {883 char *dest_top = dest + size - 1;884 885 while (*src && dest < dest_top)886 *(dest++) = *(src++);887 888 *dest = 0;889 822 } 890 823 … … 906 839 assert(size > 0); 907 840 assert(src != NULL); 908 assert(dest != NULL); 909 910 /* Copy data. */ 911 _str_cpyn(dest, size, src); 912 913 /* In-place translate invalid bytes to U_SPECIAL. */ 914 _repair_string(dest, size); 841 842 size_t src_off = 0; 843 size_t dest_off = 0; 844 845 char32_t ch; 846 while ((ch = str_decode(src, &src_off, STR_NO_LIMIT)) != 0) { 847 if (chr_encode(ch, dest, &dest_off, size - 1) != EOK) 848 break; 849 } 850 851 dest[dest_off] = '\0'; 915 852 } 916 853 … … 935 872 /* There must be space for a null terminator in the buffer. */ 936 873 assert(size > 0); 937 assert(src != NULL); 938 939 /* Copy data. */ 940 _str_cpyn(dest, min(size, n + 1), src); 941 942 /* In-place translate invalid bytes to U_SPECIAL. */ 943 _repair_string(dest, size); 874 875 size_t src_off = 0; 876 size_t dest_off = 0; 877 878 char32_t ch; 879 while ((ch = str_decode(src, &src_off, n)) != 0) { 880 if (chr_encode(ch, dest, &dest_off, size - 1) != EOK) 881 break; 882 } 883 884 dest[dest_off] = '\0'; 944 885 } 945 886 … … 957 898 void str_append(char *dest, size_t size, const char *src) 958 899 { 959 assert(src != NULL);960 assert(dest != NULL); 961 assert(size > 0);962 963 size_t dstr_size = _str_nsize(dest, size);964 _str_cpyn(dest + dstr_size, size - dstr_size, src); 965 _repair_string(dest + dstr_size, size - dstr_size);900 size_t dstr_size; 901 902 dstr_size = str_size(dest); 903 if (dstr_size >= size) 904 return; 905 906 str_cpy(dest + dstr_size, size - dstr_size, src); 966 907 } 967 908 … … 992 933 errno_t spascii_to_str(char *dest, size_t size, const uint8_t *src, size_t n) 993 934 { 994 size_t len = 0; 995 996 /* Determine the length of the source string. */ 997 for (size_t i = 0; i < n; i++) { 998 if (src[i] == 0) 999 break; 1000 1001 if (src[i] != ' ') 1002 len = i + 1; 1003 } 1004 1005 errno_t result = EOK; 1006 size_t out_len = min(len, size - 1); 1007 1008 /* Copy characters */ 1009 for (size_t i = 0; i < out_len; i++) { 1010 dest[i] = src[i]; 1011 1012 if (dest[i] < 0) { 1013 dest[i] = U_SPECIAL; 935 size_t sidx; 936 size_t didx; 937 size_t dlast; 938 uint8_t byte; 939 errno_t rc; 940 errno_t result; 941 942 /* There must be space for a null terminator in the buffer. */ 943 assert(size > 0); 944 result = EOK; 945 946 didx = 0; 947 dlast = 0; 948 for (sidx = 0; sidx < n; ++sidx) { 949 byte = src[sidx]; 950 if (!ascii_check(byte)) { 951 byte = U_SPECIAL; 1014 952 result = EIO; 1015 953 } 1016 } 1017 1018 dest[out_len] = 0; 1019 1020 if (out_len < len) 1021 return EOVERFLOW; 1022 954 955 rc = chr_encode(byte, dest, &didx, size - 1); 956 if (rc != EOK) { 957 assert(rc == EOVERFLOW); 958 dest[didx] = '\0'; 959 return rc; 960 } 961 962 /* Remember dest index after last non-empty character */ 963 if (byte != 0x20) 964 dlast = didx; 965 } 966 967 /* Terminate string after last non-empty character */ 968 dest[dlast] = '\0'; 1023 969 return result; 1024 970 } … … 1261 1207 } 1262 1208 1263 static char *_strchr(const char *str, char c)1264 {1265 while (*str != 0 && *str != c)1266 str++;1267 1268 return (*str == c) ? (char *) str : NULL;1269 }1270 1271 1209 /** Find first occurence of character in string. 1272 1210 * … … 1278 1216 char *str_chr(const char *str, char32_t ch) 1279 1217 { 1280 /* Fast path for an ASCII character. */ 1281 if (ascii_check(ch)) 1282 return _strchr(str, ch); 1283 1284 /* Convert character to UTF-8. */ 1285 char utf8[STR_BOUNDS(1) + 1]; 1286 size_t offset = 0; 1287 1288 if (chr_encode(ch, utf8, &offset, sizeof(utf8)) != EOK || offset == 0) 1289 return NULL; 1290 1291 utf8[offset] = '\0'; 1292 1293 /* Find the first byte, then check if all of them are correct. */ 1294 while (*str != 0) { 1295 str = _strchr(str, utf8[0]); 1296 if (!str) 1297 return NULL; 1298 1299 if (_test_prefix(str, utf8)) 1300 return (char *) str; 1301 1302 str++; 1218 char32_t acc; 1219 size_t off = 0; 1220 size_t last = 0; 1221 1222 while ((acc = str_decode(str, &off, STR_NO_LIMIT)) != 0) { 1223 if (acc == ch) 1224 return (char *) (str + last); 1225 last = off; 1303 1226 } 1304 1227 … … 1315 1238 char *str_str(const char *hs, const char *n) 1316 1239 { 1317 size_t hsize = _str_size(hs); 1318 size_t nsize = _str_size(n); 1319 1320 while (hsize >= nsize) { 1321 if (_test_prefix(hs, n)) 1322 return (char *) hs; 1323 1324 hs++; 1325 hsize--; 1240 size_t off = 0; 1241 1242 if (str_lcmp(hs, n, str_length(n)) == 0) 1243 return (char *)hs; 1244 1245 while (str_decode(hs, &off, STR_NO_LIMIT) != 0) { 1246 if (str_lcmp(hs + off, n, str_length(n)) == 0) 1247 return (char *)(hs + off); 1326 1248 } 1327 1249 1328 1250 return NULL; 1329 }1330 1331 static void _str_rtrim(char *str, char c)1332 {1333 char *last = str;1334 1335 while (*str) {1336 if (*str != c)1337 last = str;1338 1339 str++;1340 }1341 1342 /* Truncate string. */1343 last[1] = 0;1344 1251 } 1345 1252 … … 1351 1258 void str_rtrim(char *str, char32_t ch) 1352 1259 { 1353 /* Fast path for the ASCII case. */1354 if (ascii_check(ch)) {1355 _str_rtrim(str, ch);1356 return;1357 }1358 1359 1260 size_t off = 0; 1360 1261 size_t pos = 0; … … 1378 1279 } 1379 1280 1380 static void _str_ltrim(char *str, char c)1381 {1382 char *p = str;1383 1384 while (*p == c)1385 p++;1386 1387 if (str != p)1388 _str_cpy(str, p);1389 }1390 1391 1281 /** Removes specified leading characters from a string. 1392 1282 * … … 1396 1286 void str_ltrim(char *str, char32_t ch) 1397 1287 { 1398 /* Fast path for the ASCII case. */1399 if (ascii_check(ch)) {1400 _str_ltrim(str, ch);1401 return;1402 }1403 1404 1288 char32_t acc; 1405 1289 size_t off = 0; … … 1421 1305 } 1422 1306 1423 static char *_str_rchr(const char *str, char c)1424 {1425 const char *last = NULL;1426 1427 while (*str) {1428 if (*str == c)1429 last = str;1430 1431 str++;1432 }1433 1434 return (char *) last;1435 }1436 1437 1307 /** Find last occurence of character in string. 1438 1308 * … … 1444 1314 char *str_rchr(const char *str, char32_t ch) 1445 1315 { 1446 if (ascii_check(ch))1447 return _str_rchr(str, ch);1448 1449 1316 char32_t acc; 1450 1317 size_t off = 0; … … 1535 1402 char *str_dup(const char *src) 1536 1403 { 1537 size_t size = _str_size(src) + 1;1404 size_t size = str_size(src) + 1; 1538 1405 char *dest = malloc(size); 1539 1406 if (!dest) 1540 1407 return NULL; 1541 1408 1542 _str_cpy(dest, src); 1543 _repair_string(dest, size); 1409 str_cpy(dest, size, src); 1544 1410 return dest; 1545 1411 } … … 1567 1433 char *str_ndup(const char *src, size_t n) 1568 1434 { 1569 size_t size = _str_nsize(src, n) + 1; 1570 1571 char *dest = malloc(size); 1435 size_t size = str_size(src); 1436 if (size > n) 1437 size = n; 1438 1439 char *dest = malloc(size + 1); 1572 1440 if (!dest) 1573 1441 return NULL; 1574 1442 1575 _str_cpyn(dest, size, src); 1576 _repair_string(dest, size); 1443 str_ncpy(dest, size + 1, src, size); 1577 1444 return dest; 1578 1445 } -
kernel/generic/include/assert.h
r240b2e4 r62e3411 82 82 #else /* CONFIG_DEBUG */ 83 83 84 #define assert(expr) ((void) 0)85 #define assert_verbose(expr, msg) ((void) 0)86 #define static_assert(expr, msg) ((void) 0)84 #define assert(expr) 85 #define assert_verbose(expr, msg) 86 #define static_assert(expr, msg) 87 87 88 88 #endif /* CONFIG_DEBUG */ -
uspace/lib/c/meson.build
r240b2e4 r62e3411 62 62 'common/adt/checksum.c', 63 63 'common/adt/circ_buf.c', 64 'common/adt/list.c', 64 65 'common/adt/hash_table.c', 65 'common/adt/list.c',66 66 'common/adt/odict.c', 67 'common/gsort.c',68 67 'common/printf/printf_core.c', 69 'common/stdc/bsearch.c',70 'common/stdc/calloc.c',71 68 'common/stdc/ctype.c', 72 69 'common/stdc/mem.c', 70 'common/stdc/bsearch.c', 73 71 'common/stdc/qsort.c', 74 'common/stdc/ uchar.c',75 'common/ stdc/wchar.c',72 'common/stdc/calloc.c', 73 'common/gsort.c', 76 74 'common/str.c', 77 75 'common/str_error.c', 78 76 'common/strtol.c', 79 77 78 'generic/libc.c', 80 79 'generic/adt/prodcons.c', 81 'generic/arg_parse.c',82 80 'generic/as.c', 83 'generic/assert.c', 84 'generic/async/client.c', 85 'generic/async/ports.c', 86 'generic/async/server.c', 81 'generic/ddi.c', 82 'generic/perm.c', 87 83 'generic/capa.c', 88 84 'generic/config.c', 89 85 'generic/context.c', 90 86 'generic/dbgcon.c', 91 'generic/ddi.c',92 87 'generic/device/clock_dev.c', 93 88 'generic/device/hw_res.c', … … 96 91 'generic/dirent.c', 97 92 'generic/dlfcn.c', 98 'generic/double_to_str.c',99 93 'generic/elf/elf.c', 100 94 'generic/elf/elf_load.c', 101 95 'generic/elf/elf_mod.c', 96 'generic/event.c', 102 97 'generic/errno.c', 103 'generic/event.c', 104 'generic/getopt.c', 105 'generic/ieee_double.c', 98 'generic/inttypes.c', 99 'generic/loc.c', 100 'generic/string.c', 101 'generic/l18n/langs.c', 102 'generic/pcb.c', 103 'generic/pio_trace.c', 104 'generic/smc.c', 105 'generic/task.c', 106 106 'generic/imath.c', 107 'generic/inttypes.c',108 107 'generic/io/asprintf.c', 109 108 'generic/io/io.c', 109 'generic/io/printf.c', 110 'generic/io/log.c', 111 'generic/io/logctl.c', 110 112 'generic/io/kio.c', 111 113 'generic/io/klog.c', 112 'generic/io/log.c',113 'generic/io/logctl.c',114 'generic/io/printf.c',115 114 'generic/io/snprintf.c', 116 'generic/io/table.c',117 115 'generic/io/vprintf.c', 118 116 'generic/io/vsnprintf.c', 119 'generic/i pc.c',117 'generic/io/table.c', 120 118 'generic/irq.c', 121 'generic/l18n/langs.c', 122 'generic/libc.c', 123 'generic/loader.c', 124 'generic/loc.c', 119 'generic/ieee_double.c', 120 'generic/power_of_ten.c', 121 'generic/double_to_str.c', 125 122 'generic/malloc.c', 126 'generic/ns.c',127 'generic/pcb.c',128 'generic/perm.c',129 'generic/pio_trace.c',130 'generic/power_of_ten.c',131 123 'generic/rndgen.c', 132 'generic/setjmp.c',133 124 'generic/shutdown.c', 134 'generic/smc.c',135 'generic/stack.c',136 'generic/stacktrace.c',137 'generic/stats.c',138 'generic/stdio.c',139 125 'generic/stdio/scanf.c', 140 126 'generic/stdio/sprintf.c', … … 142 128 'generic/stdio/sstream.c', 143 129 'generic/stdio/vsprintf.c', 144 'generic/stdlib.c',145 'generic/string.c',146 'generic/sysinfo.c',147 'generic/task.c',148 130 'generic/thread/fibril.c', 149 131 'generic/thread/fibril_synch.c', 132 'generic/thread/thread.c', 133 'generic/thread/tls.c', 150 134 'generic/thread/futex.c', 151 135 'generic/thread/mpsc.c', 152 'generic/thread/thread.c', 153 'generic/thread/tls.c', 136 'generic/sysinfo.c', 137 'generic/ipc.c', 138 'generic/ns.c', 139 'generic/async/client.c', 140 'generic/async/server.c', 141 'generic/async/ports.c', 142 'generic/loader.c', 143 'generic/getopt.c', 154 144 'generic/time.c', 155 145 'generic/tmpfile.c', 156 'generic/ubsan.c', 146 'generic/stdio.c', 147 'generic/stdlib.c', 157 148 'generic/udebug.c', 158 'generic/uuid.c',159 149 'generic/vfs/canonify.c', 160 150 'generic/vfs/inbox.c', 161 151 'generic/vfs/mtab.c', 162 152 'generic/vfs/vfs.c', 153 'generic/setjmp.c', 154 'generic/stack.c', 155 'generic/stacktrace.c', 156 'generic/arg_parse.c', 157 'generic/stats.c', 158 'generic/assert.c', 159 'generic/ubsan.c', 160 'generic/uuid.c', 163 161 ) 164 162 165 163 if CONFIG_RTLD 166 164 src += files( 165 'generic/rtld/rtld.c', 167 166 'generic/rtld/dynamic.c', 168 167 'generic/rtld/module.c', 169 'generic/rtld/rtld.c',170 168 'generic/rtld/symbol.c', 171 169 ) … … 192 190 'test/qsort.c', 193 191 'test/sprintf.c', 192 'test/stdio/scanf.c', 194 193 'test/stdio.c', 195 'test/stdio/scanf.c',196 194 'test/stdlib.c', 197 195 'test/str.c', 198 196 'test/string.c', 199 197 'test/strtol.c', 200 'test/uchar.c',201 198 'test/uuid.c', 202 199 ) -
uspace/lib/c/test/main.c
r240b2e4 r62e3411 57 57 PCUT_IMPORT(strtol); 58 58 PCUT_IMPORT(table); 59 PCUT_IMPORT(uchar);60 59 PCUT_IMPORT(uuid); 61 60 -
uspace/lib/ext4/src/extent.c
r240b2e4 r62e3411 888 888 ext4_extent_path_t *old_root = path + 1; 889 889 890 for (int i = path->depth; i >= 0; i--) 891 path[i + 1] = path[i]; 892 890 size_t nbytes = sizeof(ext4_extent_path_t) * (path->depth + 1); 891 memmove(old_root, new_root, nbytes); 893 892 memset(new_root, 0, sizeof(ext4_extent_path_t)); 894 893
Note:
See TracChangeset
for help on using the changeset viewer.
