Merge pull request #43 from tezc/string-perf

Minor string trim fix, minor doc change
This commit is contained in:
Tezc 2021-02-15 00:29:55 +03:00 committed by GitHub
commit ed5bcab2b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 4 deletions

View File

@ -8,7 +8,6 @@ There is no build, copy .h .c files you want.
Libraries are portable, see [test](#test) section for details. Libraries are portable, see [test](#test) section for details.
As a general rule, all libraries report errors back to users (e.g out of memory). As a general rule, all libraries report errors back to users (e.g out of memory).
If a library uses heap memory, you can plug your allocator.
### List ### List
@ -29,7 +28,7 @@ If a library uses heap memory, you can plug your allocator.
| **[perf](perf)** | Benchmark utility to get performance counters info via perf_event_open() | | **[perf](perf)** | Benchmark utility to get performance counters info via perf_event_open() |
| **[queue](queue)** | Generic queue which can be used as dequeue/stack/list as well | | **[queue](queue)** | Generic queue which can be used as dequeue/stack/list as well |
| **[sc](sc)** | Utility functions | | **[sc](sc)** | Utility functions |
| **[signal](signal)** | Signal handler & signal safe snprintf (handling CTRL+C, printing backtrace on crash etc) | | **[signal](signal)** | Signal safe snprintf & Signal handler (handling CTRL+C, printing backtrace on crash etc) |
| **[socket](socket)** | Pipe / tcp sockets(also unix domain sockets) /Epoll/Kqueue/WSAPoll for Posix and Windows | | **[socket](socket)** | Pipe / tcp sockets(also unix domain sockets) /Epoll/Kqueue/WSAPoll for Posix and Windows |
| **[string](string)** | Length prefixed, null terminated C strings. | | **[string](string)** | Length prefixed, null terminated C strings. |
| **[thread](thread)** | Thread wrapper for Posix and Windows. | | **[thread](thread)** | Thread wrapper for Posix and Windows. |

View File

@ -283,7 +283,7 @@ bool sc_str_trim(char **str, const char *list)
return true; return true;
} }
len = strlen(*str); len = sc_str_meta(*str)->len;
start = *str + strspn(*str, list); start = *str + strspn(*str, list);
end = (*str) + len; end = (*str) + len;