Fix typos (#117)

This commit is contained in:
Bailey Thompson
2020-08-18 02:16:51 -04:00
committed by GitHub
parent b7cd535c6c
commit 59380a1389

View File

@@ -4,19 +4,19 @@ in-depth documentation, visit the
[code docs](https://codedocs.xyz/bkthomps/Containers/) page. [code docs](https://codedocs.xyz/bkthomps/Containers/) page.
## General Overview ## General Overview
Each container has an initialization function which returns the container Each container has an initialization function which returns a container object.
object. For a deque, this would be `deque_init()` which returns a `deque`. The For a deque, this would be `deque_init()` which returns a `deque`. The returned
returned object is a pointer to an internal struct which contains data and object is a pointer to an internal struct which contains information, but this
book keeping information. However, this is abstracted away to reduce mistakes, is abstracted away to reduce mistakes and make development easier. More
and since it is not stored in the most easy manner. More information about the information about the initialization functions is presented below in its own
initialization type of function is presented below in its own section. section.
Once this object is initialized, it is possible to manipulate it using the Once a container object is initialized, it is possible to manipulate it using
provided functions, which have in-depth documentation available. Each container the provided functions, which have in-depth documentation available. Each
has adding and retrieval type functions, and each type of container has its own container has adding and retrieval type functions, and each type of container
specific set of function interfaces, which are explained in-depth at the has its own specific set of function interfaces, which are explained in-depth at
function level in the code docs link above. More high-level information will be the function level in the code docs link above. More high-level information will
explained in its own section below. be explained in its own section below.
Finally, each container will have to be destroyed to free the memory associated Finally, each container will have to be destroyed to free the memory associated
with it. with it.
@@ -71,9 +71,8 @@ bk_err rc = deque_pop_back(&retrieve, d); /* retrieve now is equal to 5 */
Functions can fail for various reasons, such as the provided index argument Functions can fail for various reasons, such as the provided index argument
being out of bounds, or the system running out of memory. The in-depth being out of bounds, or the system running out of memory. The in-depth
documentation linked above provides the exhaustive list of return codes for each documentation linked above provides the exhaustive list of return codes for each
function, which are present in the `errno.h` header file. For example, an function, which are present in the header file. For example, an invalid argument
invalid argument would return `-BK_EINVAL`, and on success `BK_OK` would be would return `-BK_EINVAL`, and on success `BK_OK` would be returned.
returned.
# Comparators and Hash Functions # Comparators and Hash Functions
The associative containers and the priority queue require the user to initialize The associative containers and the priority queue require the user to initialize
@@ -82,7 +81,7 @@ require a hash function to be passed in. State should not be modified in
comparators or in hash functions, or else it would lead to undefined behavior. comparators or in hash functions, or else it would lead to undefined behavior.
When a comparator function is called, two arguments are passed in, being two When a comparator function is called, two arguments are passed in, being two
elements to compare. The comparator must return 0 is they are equal, a negative elements to compare. The comparator must return 0 if they are equal, a negative
value if the first is less than the second, and a positive value is the first is value if the first is less than the second, and a positive value is the first is
greater than the second. To be valid, a comparator must obey the following greater than the second. To be valid, a comparator must obey the following
rules: rules: