{"id":22912898,"url":"https://github.com/demindiro/c-string","last_synced_at":"2025-04-01T11:25:22.427Z","repository":{"id":137321163,"uuid":"157982891","full_name":"Demindiro/c-string","owner":"Demindiro","description":"C library for strings that are both null-terminated and length-prefixed.","archived":false,"fork":false,"pushed_at":"2018-12-19T11:20:18.000Z","size":27,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-07T06:26:58.418Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Demindiro.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-11-17T12:35:13.000Z","updated_at":"2018-12-19T11:14:47.000Z","dependencies_parsed_at":null,"dependency_job_id":"dc0e808b-d638-4857-9bc6-299b853626a2","html_url":"https://github.com/Demindiro/c-string","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Demindiro%2Fc-string","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Demindiro%2Fc-string/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Demindiro%2Fc-string/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Demindiro%2Fc-string/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Demindiro","download_url":"https://codeload.github.com/Demindiro/c-string/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246629726,"owners_count":20808379,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-14T04:30:05.487Z","updated_at":"2025-04-01T11:25:22.407Z","avatar_url":"https://github.com/Demindiro.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"C Strings\n=========\n\nA library for manipulating length-prefixes strings.\n\n\nWhy use length-prefixed strings instead of just null-terminated strings?\n------------------------------------------------------------------------\n\nThere are two major advantages:\n\n- **Speed**: knowing how long a string is makes it much easier to predict how\n  large a buffer should be, avoiding a lot of `realloc`s.\n- **Simplicty**: There is no need to constantly check for a null terminator,\n  nor is there any need to always use `strlen`: just use the `len` member\n  of `string`or `string_t`.\n\nThe only disadvantage is an extra 8 bytes of memory used - whcich is negligible\nconsidering how much RAM most devices have nowadays.\n\n\nFAQ\n---\n\nOr well, questions I assume will be asked :P\n\n### Why both null-terminated and length-prefixed?\nHaving null-terminated strings allows the use of ANSI C functions directly\nwithout having to go through the hassle of converting back and forth.\n\n### Why both `string_t` and `string`?\nUsing `string_t` may be faster in some edge cases because it is stack-allocated\nand doesn't use `malloc` and `free`. However, it is only recommended to use it\nto solve significant bottlenecks.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdemindiro%2Fc-string","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdemindiro%2Fc-string","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdemindiro%2Fc-string/lists"}