microoptimize extract_version()

This commit is contained in:
nick black 2021-06-20 06:47:52 -04:00
parent b2d04feffd
commit 6152f621ba
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

View File

@ -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;