<feed xmlns='http://www.w3.org/2005/Atom'>
<title>rayedit.git/vector.h, branch master</title>
<subtitle>Text editor for large files
</subtitle>
<id>http://git.dilluti0n.com/rayedit.git/atom?h=master</id>
<link rel='self' href='http://git.dilluti0n.com/rayedit.git/atom?h=master'/>
<link rel='alternate' type='text/html' href='http://git.dilluti0n.com/rayedit.git/'/>
<updated>2025-05-14T09:40:29Z</updated>
<entry>
<title>fix: double-free of line object in eb_backspace and eb_delete_line</title>
<updated>2025-05-14T09:40:29Z</updated>
<author>
<name>dilluti0n</name>
<email>hskimse1@gmail.com</email>
</author>
<published>2025-05-14T06:46:33Z</published>
<link rel='alternate' type='text/html' href='http://git.dilluti0n.com/rayedit.git/commit/?id=502aea93b7e2cae6a17d83e6989109d56c9ec79f'/>
<id>urn:sha1:502aea93b7e2cae6a17d83e6989109d56c9ec79f</id>
<content type='text'>
On eb_backspace, when the upper line was non-null, line_cat followed
by line_free, and eb_delete_line only cleared the line_vec. However,
commit 2441e78 introduced an additional line_free in eb_delete_line to
fix a memory leak, which led to a double-free for that line. This
patch resolves that problem.
</content>
</entry>
<entry>
<title>refactor: introduce mem.h; wrappers for allocators</title>
<updated>2025-05-10T13:51:23Z</updated>
<author>
<name>dilluti0n</name>
<email>hskimse1@gmail.com</email>
</author>
<published>2025-05-10T13:13:33Z</published>
<link rel='alternate' type='text/html' href='http://git.dilluti0n.com/rayedit.git/commit/?id=d6872a59a28c8db551ff0b18c9d9041c5cbaa5a5'/>
<id>urn:sha1:d6872a59a28c8db551ff0b18c9d9041c5cbaa5a5</id>
<content type='text'>
This patch removes the dependency on raylib when allocating memory.
</content>
</entry>
<entry>
<title>fix: Memory Leak in eb_delete_line</title>
<updated>2025-05-10T13:20:29Z</updated>
<author>
<name>dilluti0n</name>
<email>hskimse1@gmail.com</email>
</author>
<published>2025-05-10T11:12:49Z</published>
<link rel='alternate' type='text/html' href='http://git.dilluti0n.com/rayedit.git/commit/?id=2441e78bffaef89dcea64c547329e541250553e7'/>
<id>urn:sha1:2441e78bffaef89dcea64c547329e541250553e7</id>
<content type='text'>
The function eb_delete_line did not properly free the contents of the
entry when deleting an element from eb-&gt;line_vec. This patch fixes
that issue.
</content>
</entry>
<entry>
<title>minor: use #pragma once instead of #ifndef ... on vector.h</title>
<updated>2025-05-01T13:37:10Z</updated>
<author>
<name>dilluti0n</name>
<email>hskimse1@gmail.com</email>
</author>
<published>2025-05-01T13:36:40Z</published>
<link rel='alternate' type='text/html' href='http://git.dilluti0n.com/rayedit.git/commit/?id=e92971fbd61e28d02f439d0d993d8693e079098c'/>
<id>urn:sha1:e92971fbd61e28d02f439d0d993d8693e079098c</id>
<content type='text'>
</content>
</entry>
<entry>
<title>refactor: introduce lazy loading to each line buffer.</title>
<updated>2025-04-29T07:12:29Z</updated>
<author>
<name>dilluti0n</name>
<email>hskimse1@gmail.com</email>
</author>
<published>2025-04-29T06:54:05Z</published>
<link rel='alternate' type='text/html' href='http://git.dilluti0n.com/rayedit.git/commit/?id=681aca7025dd1d43700b55d8a254bb61881d4b06'/>
<id>urn:sha1:681aca7025dd1d43700b55d8a254bb61881d4b06</id>
<content type='text'>
Each `struct line` now holds a pointer (`origin`) to its corresponding
line in the mmap'd file, along with its length (`origin_len`). The
`vec` field is no longer allocated for each line during
`eb_load_file`.

Instead, actual memory allocation and copying into `vec` occurs only
when an edit is made or when `line_get_string` is called (since a C
string is required). This behavior is handled via the internal inline
function `edit_happen`.

Also implement `vec_cat_raw` to `line_cat` when lazy `src`.

[minor]
Remove unused debug messages in editor.c.
</content>
</entry>
<entry>
<title>perf: reduce to a single allocation in line_init_from_buf</title>
<updated>2025-04-29T05:39:12Z</updated>
<author>
<name>dilluti0n</name>
<email>hskimse1@gmail.com</email>
</author>
<published>2025-04-29T05:36:07Z</published>
<link rel='alternate' type='text/html' href='http://git.dilluti0n.com/rayedit.git/commit/?id=21dd60f0fba9be465ccaac4ae05c2b3aba505f1a'/>
<id>urn:sha1:21dd60f0fba9be465ccaac4ae05c2b3aba505f1a</id>
<content type='text'>
Previously, line_init_from_buf called line_init followed by
vec_resize, which could result in up to two separate allocations. This
patch introduces vec_init_with_capacity, allowing the vector to be
initialized with the required capacity in a single step, reducing
allocation overhead.
</content>
</entry>
<entry>
<title>perf: improve vec_resize to not realloc again and again</title>
<updated>2025-04-29T05:22:03Z</updated>
<author>
<name>dilluti0n</name>
<email>hskimse1@gmail.com</email>
</author>
<published>2025-04-29T05:22:03Z</published>
<link rel='alternate' type='text/html' href='http://git.dilluti0n.com/rayedit.git/commit/?id=1e1e22a2c2021fa1ed25932a742d310b039a09d5'/>
<id>urn:sha1:1e1e22a2c2021fa1ed25932a742d310b039a09d5</id>
<content type='text'>
</content>
</entry>
<entry>
<title>implement: vec_clear</title>
<updated>2025-04-28T05:08:55Z</updated>
<author>
<name>dilluti0n</name>
<email>hskimse1@gmail.com</email>
</author>
<published>2025-04-28T05:08:35Z</published>
<link rel='alternate' type='text/html' href='http://git.dilluti0n.com/rayedit.git/commit/?id=853154b4a3a2fc774d7cdbfdfcb7445a374e07f5'/>
<id>urn:sha1:853154b4a3a2fc774d7cdbfdfcb7445a374e07f5</id>
<content type='text'>
It just bump size to 0.
</content>
</entry>
<entry>
<title>fix: inserting on newline cause segmentatnion fault</title>
<updated>2025-04-27T06:22:58Z</updated>
<author>
<name>dilluti0n</name>
<email>hskimse1@gmail.com</email>
</author>
<published>2025-04-27T06:17:49Z</published>
<link rel='alternate' type='text/html' href='http://git.dilluti0n.com/rayedit.git/commit/?id=531027c2299486b1727d8e22bc10ac32040acc78'/>
<id>urn:sha1:531027c2299486b1727d8e22bc10ac32040acc78</id>
<content type='text'>
This was rely on NULL-initialization of physically allocated
vector. When I remove that feature, it immediatly segfalt since
logically v-&gt;data[index] is not allocated so its not initialized by
NULL yet.

[minor]
add assert on vec_get to avoid this kind of stupid mistake.
</content>
</entry>
<entry>
<title>change: remove zero initialization on allocation</title>
<updated>2025-04-27T06:14:48Z</updated>
<author>
<name>dilluti0n</name>
<email>hskimse1@gmail.com</email>
</author>
<published>2025-04-27T06:14:48Z</published>
<link rel='alternate' type='text/html' href='http://git.dilluti0n.com/rayedit.git/commit/?id=805a4d20721b53ae3a83f0ca59f6baeac7174520'/>
<id>urn:sha1:805a4d20721b53ae3a83f0ca59f6baeac7174520</id>
<content type='text'>
instead, this will handle on *_resize for logically allocated segmants.

[minor]
refactor function vec_grow_to_size to proper name *_resize
</content>
</entry>
</feed>
