Conversation
Contributor
Author
|
sorry for the git issue... i couldnt open the old one |
| /// \return string Owned string | ||
| /// | ||
| /// \see clone_to_cstring | ||
| string string_clone(string str); // this allocates as well |
Member
There was a problem hiding this comment.
we can get rid of these old "this allocates as well" side comments, since we're committing to actual doc comments
| /// Allocates a buffer containing the concatenation of a and b. | ||
| /// | ||
| /// \return str Allocated string containing ab, without a null terminator. | ||
| string string_concat(string a, string b); // allocates |
| #define vec_header(vec) ((VecHeader*)((char*)(vec) - sizeof(VecHeader))) | ||
| /// Get the pointer to a vec's elements from the header. | ||
| #define vec_elems_from_header(header) ((void*)((char*)(header) + sizeof(VecHeader))) | ||
| #define vec_elems_from_header(header) ((void*)((u8*)(header) + sizeof(VecHeader))) |
| char* raw = malloc(len); | ||
|
|
||
| memset(raw, '\0', len); | ||
| inline string string_alloc(usize len) { |
Member
There was a problem hiding this comment.
functions should either not be inline at all, or inline static and put in the header.
| } | ||
|
|
||
| int string_cmp(string a, string b) { | ||
| u8 string_cmp(string a, string b) { |
Member
There was a problem hiding this comment.
this an incorrect signature, should not have been modified in the first place
| } | ||
| return true; | ||
| inline bool string_eq(string a, string b) { | ||
| return a.len == 0 || (a.len == b.len && string_cmp(a, b) == 0); |
Member
There was a problem hiding this comment.
this an incorrect completely, should not have been modified in the first place
| } | ||
|
|
||
| void printstr(string str) { | ||
| inline void printstr(string str) { |
Member
There was a problem hiding this comment.
no inline on public functions in a .c file, it should be static inline inside the header or not inline at all
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.