Tim Duesterhus | c1af0ba | 2021-09-15 13:58:43 +0200 | [diff] [blame] | 1 | @@ |
| 2 | struct ist i; |
| 3 | expression p, l; |
| 4 | @@ |
| 5 | |
Tim Duesterhus | 99f4737 | 2022-03-15 13:11:05 +0100 | [diff] [blame] | 6 | ( |
Tim Duesterhus | 14abfb6 | 2022-03-15 13:11:07 +0100 | [diff] [blame] | 7 | - i.ptr = p; |
| 8 | - i.len = strlen(i.ptr); |
| 9 | + i = ist(p); |
Tim Duesterhus | 99f4737 | 2022-03-15 13:11:05 +0100 | [diff] [blame] | 10 | | |
Tim Duesterhus | c1af0ba | 2021-09-15 13:58:43 +0200 | [diff] [blame] | 11 | - i.ptr = p; |
| 12 | - i.len = l; |
| 13 | + i = ist2(p, l); |
Tim Duesterhus | 99f4737 | 2022-03-15 13:11:05 +0100 | [diff] [blame] | 14 | ) |
Tim Duesterhus | c1af0ba | 2021-09-15 13:58:43 +0200 | [diff] [blame] | 15 | |
| 16 | @@ |
| 17 | @@ |
| 18 | |
| 19 | - ist2(NULL, 0) |
| 20 | + IST_NULL |
| 21 | |
| 22 | @@ |
| 23 | struct ist i; |
| 24 | expression e; |
| 25 | @@ |
| 26 | |
| 27 | - i.ptr += e; |
| 28 | - i.len -= e; |
| 29 | + i = istadv(i, e); |
| 30 | |
| 31 | @@ |
| 32 | struct ist i; |
| 33 | @@ |
| 34 | |
Tim Duesterhus | ef00c53 | 2021-11-04 22:35:43 +0100 | [diff] [blame] | 35 | - i = istadv(i, 1); |
| 36 | + i = istnext(i); |
| 37 | |
| 38 | @@ |
| 39 | struct ist i; |
Tim Duesterhus | ef00c53 | 2021-11-04 22:35:43 +0100 | [diff] [blame] | 40 | @@ |
| 41 | |
| 42 | - i.ptr++; |
| 43 | - i.len--; |
| 44 | + i = istnext(i); |
| 45 | |
| 46 | @@ |
| 47 | struct ist i; |
| 48 | @@ |
| 49 | |
Tim Duesterhus | 958f504 | 2021-11-06 15:14:43 +0100 | [diff] [blame] | 50 | - (\(i.ptr\|istptr(i)\) + \(i.len\|istlen(i)\)) |
| 51 | + istend(i) |
| 52 | |
| 53 | @@ |
| 54 | struct ist i; |
Tim Duesterhus | 9b80a6c | 2021-11-08 09:05:00 +0100 | [diff] [blame] | 55 | expression e; |
| 56 | @@ |
| 57 | |
| 58 | - if (\(i.len\|istlen(i)\) > e) { i.len = e; } |
| 59 | + i = isttrim(i, e); |
| 60 | |
| 61 | @@ |
| 62 | struct ist i; |
Tim Duesterhus | 755d241 | 2021-11-08 09:05:02 +0100 | [diff] [blame] | 63 | struct buffer *b; |
| 64 | @@ |
| 65 | |
| 66 | - chunk_memcat(b, \(i.ptr\|istptr(i)\) , \(i.len\|istlen(i)\)); |
| 67 | + chunk_istcat(b, i); |
| 68 | |
| 69 | @@ |
| 70 | struct ist i; |
Tim Duesterhus | 958f504 | 2021-11-06 15:14:43 +0100 | [diff] [blame] | 71 | @@ |
| 72 | |
Tim Duesterhus | c1af0ba | 2021-09-15 13:58:43 +0200 | [diff] [blame] | 73 | - i.ptr != NULL |
| 74 | + isttest(i) |
| 75 | |
| 76 | @@ |
| 77 | char *s; |
| 78 | @@ |
| 79 | |
| 80 | ( |
| 81 | - ist2(s, strlen(s)) |
| 82 | + ist(s) |
| 83 | | |
| 84 | - ist2(strdup(s), strlen(s)) |
| 85 | + ist(strdup(s)) |
| 86 | ) |