Skip to content

Commit cc44676

Browse files
committed
cleanup + optimizations & fast paths
1 parent adf7141 commit cc44676

File tree

4 files changed

+351
-192
lines changed

4 files changed

+351
-192
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
## Robust C by default
44
**A dialect of C with `defer` and automatic zero-initialization.**
55

6-
Prism is a single-file transpiler that makes C safer without changing how you write it.
6+
Prism is a lightweight and very fast transpiler that makes C safer without changing how you write it.
77

8-
- **1234 tests** — edge cases, control flow, nightmares, trying hard to break Prism
8+
- **1248 tests** — edge cases, control flow, nightmares, trying hard to break Prism
99
- **Building Real C** — OpenSSL, SQLite, Bash, GNU Coreutils, Make, Curl
1010
- **Proper transpiler** — tracks typedefs, respects scope, catches unsafe patterns
1111
- **Opt-out features** Disable parts of the transpiler, like zero-init, with CLI flags

parse.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ static void hashmap_put(HashMap *map, char *key, int keylen, void *val)
494494
map->used++;
495495
}
496496

497-
static void hashmap_delete2(HashMap *map, char *key, int keylen)
497+
static void hashmap_delete(HashMap *map, char *key, int keylen)
498498
{
499499
if (!map->buckets)
500500
return;
@@ -742,15 +742,16 @@ static inline const char *digraph_equiv(Token *tok)
742742
if (tok->len != 2)
743743
return NULL;
744744

745-
if (!memcmp(tok->loc, "<:", 2))
745+
char a = tok->loc[0], b = tok->loc[1];
746+
if (a == '<' && b == ':')
746747
return "[";
747-
if (!memcmp(tok->loc, ":>", 2))
748+
if (a == ':' && b == '>')
748749
return "]";
749-
if (!memcmp(tok->loc, "<%", 2))
750+
if (a == '<' && b == '%')
750751
return "{";
751-
if (!memcmp(tok->loc, "%>", 2))
752+
if (a == '%' && b == '>')
752753
return "}";
753-
if (!memcmp(tok->loc, "%:", 2))
754+
if (a == '%' && b == ':')
754755
return "#";
755756

756757
return NULL;

0 commit comments

Comments
 (0)