Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added more functionalities to kvec #181

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Carlos-Mero
Copy link

The original implementation of kvec.h is quite old (the last modification is even 12 years before) and lacks a bunch of functionalities. So I made some improvements to the source code.

  • I added a statement to kv_resize so that it can correctly handle the changes of (v).n while resizing.
  • I added two macros kv_insert and kv_remove as dynamic operations on the vector. They are some basic operations adopted by STL in C++ and other implementations of vector.
  • The original kv_pop method didn't decrease the capability of the vector, which could cause memory waste in some cases. So I defined another macro called kv_p to address this problem. The macro kv_pop is kept unchanged for capability, and it can be used for better performance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant