diff options
author | Jan-Erik Rediger <badboy@archlinux.us> | 2014-02-06 17:39:28 +0100 |
---|---|---|
committer | Johannes Löthberg <johannes@kyriasis.com> | 2014-12-03 19:30:06 +0100 |
commit | 526df29f6f90cbbf079155555a6db2c18845852a (patch) | |
tree | cbdd2c487f635d88c317075e97dd3fbd990d31a0 | |
parent | 6d2a71cfdb3dc2adf08c258e624a0547591828c5 (diff) | |
download | sds-526df29f6f90cbbf079155555a6db2c18845852a.tar.xz |
Fixed some typos and grammar.
Some typos where found by aspell: `aspell -l en_US check README.md`
-rw-r--r-- | README.md | 20 |
1 files changed, 10 insertions, 10 deletions
@@ -211,9 +211,9 @@ Destroying strings void sdsfree(sds s); ``` -The destroy an SDS string there is just to call `sdsfree` with the string -pointer. However note that empty strings created with `sdsempty` need to be -destroyed as well otherwise they'll result into a memory leak. +To destroy an SDS string just call `sdsfree` with the string +pointer. Note, however, that empty strings created with `sdsempty` need to be +destroyed as well otherwise they'll result in a memory leak. The function `sdsfree` does not perform any operation if instead of an SDS string pointer, `NULL` is passed, so you don't need to check for `NULL` explicitly before calling it: @@ -310,8 +310,8 @@ s = sdscatprintf(s,"%d+%d = %d",a,b,a+b); ``` Often you need to create SDS string directly from `printf` format specifiers. -Because `sdscatprintf` is actually a function that concatenates strings all -you need is to concatenate your string to an empty string: +Because `sdscatprintf` is actually a function that concatenates strings, all +you need to do is to concatenate your string to an empty string: ```c @@ -496,7 +496,7 @@ purposes, it is often important to turn a string that may contain binary data or special characters into a quoted string. Here by quoted string we mean the common format for String literals in programming source code. However today this format is also part of the well known serialization formats -like JSON and CSV, so it definitely escaped the simple gaol of representing +like JSON and CSV, so it definitely escaped the simple goal of representing literal strings in the source code of programs. An example of quoted string literal is the following: @@ -515,7 +515,7 @@ existing string the quoted string representation of the input string. sds sdscatrepr(sds s, const char *p, size_t len); ``` -The `scscatrepr` (where `repr` means *representation*) follows the usualy +The `scscatrepr` (where `repr` means *representation*) follows the usually SDS string function rules accepting a char pointer and a length, so you can use it with SDS strings, normal C strings by using strlen() as `len` argument, or binary data. The following is an example usage: @@ -560,7 +560,7 @@ A more common separator that consists of a single character is the comma: foo,bar,zap ``` -In many progrems it is useful to process a line in order to obtain the sub +In many programs it is useful to process a line in order to obtain the sub strings it is composed of, so SDS provides a function that returns an array of SDS strings given a string and a separator. @@ -594,7 +594,7 @@ output> World! The returned array is heap allocated, and the single elements of the array are normal SDS strings. You can free everything calling `sdsfreesplitres` -as in the example. Alternativey you are free to release the array yourself +as in the example. Alternatively you are free to release the array yourself using the `free` function and use and/or free the individual SDS strings as usual. @@ -671,7 +671,7 @@ Error handling All the SDS functions that return an SDS pointer may also return `NULL` on out of memory, this is basically the only check you need to perform. -However many modern C programs handle out of memory simply aborting the program +However many modern C programs handle out of memory by simply aborting the program so you may want to do this as well by wrapping `malloc` and other related memory allocation calls directly. |