mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-20 03:25:47 +00:00
microoptimize extract_version()
This commit is contained in:
parent
b2d04feffd
commit
6152f621ba
@ -724,7 +724,7 @@ ruts_string(query_state* inits, initstates_e state){
|
|||||||
// extract the terminal version from the running string, following 'prefix'
|
// extract the terminal version from the running string, following 'prefix'
|
||||||
static int
|
static int
|
||||||
extract_version(query_state* qstate, const char* prefix){
|
extract_version(query_state* qstate, const char* prefix){
|
||||||
size_t bytes = strlen(qstate->runstring) - strlen(prefix) + 1;
|
size_t bytes = strlen(qstate->runstring + strlen(prefix)) + 1;
|
||||||
qstate->version = malloc(bytes);
|
qstate->version = malloc(bytes);
|
||||||
if(qstate->version == NULL){
|
if(qstate->version == NULL){
|
||||||
return -1;
|
return -1;
|
||||||
|
Loading…
Reference in New Issue
Block a user