mirror of
https://github.com/zeldaret/oot.git
synced 2024-11-25 17:54:15 +00:00
eadc477187
* Update makefiles * git subrepo clone git@github.com:EllipticEllipsis/fado.git tools/fado subrepo: subdir: "tools/fado" merged: "46c4d751a" upstream: origin: "git@github.com:EllipticEllipsis/fado.git" branch: "master" commit: "46c4d751a" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * git subrepo pull tools/fado subrepo: subdir: "tools/fado" merged: "88114ebce" upstream: origin: "git@github.com:EllipticEllipsis/fado.git" branch: "master" commit: "88114ebce" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * A few ideas for computing dependencies * Remove reserved identifiers from spec.h and util.h and add required headers * Fix a couple more headers * Program for reloc prerequisites * git subrepo pull tools/fado subrepo: subdir: "tools/fado" merged: "36a905f72" upstream: origin: "git@github.com:EllipticEllipsis/fado.git" branch: "master" commit: "36a905f72" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * Update makefile to make dependency files and use overlay's name * git subrepo pull tools/fado subrepo: subdir: "tools/fado" merged: "43c339a59" upstream: origin: "git@github.com:EllipticEllipsis/fado.git" branch: "master" commit: "43c339a59" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * Change awk to grep, delete ZAPD files, gitignore elf * Delete all the cfg files * Fix memory leaks * Rename and add coloured errors * Makefile tweaks - preprocess spec before grep - split order prerequisites via phony target to reduce dependency edges - remove `resources` target - remove separate overlays targets - use `$(SPEC)` throughout - change to using filenames of relocs for overlay names via `$*` - Rearrange targets to better reflect their categories * Update gitignore * Review * Add a check for the reloc file name * get_segment_by_name * get_stmt_id_by_stmt_name * Cleaning up * algorithm change * function rename * Fix typos Co-authored-by: angie <angheloalf95@gmail.com> |
||
---|---|---|
.. | ||
.gitrepo | ||
.travis.yml | ||
LICENSE.md | ||
Makefile | ||
README.md | ||
vc_vector.c | ||
vc_vector.h | ||
vc_vector_test.c | ||
vc_vector_test.h |
vc_vector
Fast simple C vector implementation
Usage
Basic
#include "vc_vector.h"
int main() {
// Creates an empty vector with the default reserved size
// and without custom deleter. Vector will contain 'int'
vc_vector* v = vc_vector_create(0, sizeof(int), NULL);
if (!v) {
return 1;
}
const int count = 10;
for (int i = 0; i < count; ++i) {
// The function takes a pointer to the elements,
// but the vector will make a copy of the element
vc_vector_push_back(v, &i);
}
// Print each vector element
for (void* i = vc_vector_begin(v);
i != vc_vector_end(v);
i = vc_vector_next(v, i)) {
printf("%u; ", *(int*)i);
}
vc_vector_release(v);
return 0;
}
Advanced
#include "vc_vector.h"
struct Item {
int val1;
int val2;
};
int main() {
const int n = 10;
// Creates an empty vector with the reserved size for the 'n' elements
// and with custom deleter 'free'. Vector will contain pointers to 'Item'
vc_vector* v = vc_vector_create(n, sizeof(struct Node*), free);
if (!v) {
return 1;
}
struct Item* item = NULL;
const int count = n + 1;
// Vector automatically increases the reserved size when 'n + 1' will be added
for (int i = 0; i < count; ++i) {
// Creating item
item = malloc(sizeof(struct Item));
if (!item) {
continue;
}
item->val1 = i;
item->val2 = 0;
// Pushing to the end of the vector
if (!vc_vector_push_back(v, item)) {
// If the item was not pushed, you have to delete it
free(item);
}
}
// ...
// Calls custom deleter 'free' for all items
// and releases the vector
vc_vector_release(v);
return 0;
}