diff options
author | Justus Winter <[email protected]> | 2017-04-04 12:28:45 +0000 |
---|---|---|
committer | Justus Winter <[email protected]> | 2017-04-04 13:04:42 +0000 |
commit | d858096c99705ccf2e115475f81c4cf88edbeebf (patch) | |
tree | be8bed53e7f0d32426a00e0bfe8c2ba89d97af5c /tests | |
parent | po: Update Japanese translation. (diff) | |
download | gnupg-d858096c99705ccf2e115475f81c4cf88edbeebf.tar.gz gnupg-d858096c99705ccf2e115475f81c4cf88edbeebf.zip |
gpgscm: Simplify substring operation.
* tests/gpgscm/scheme.c (opexe_2): Simplify 'substring'.
Signed-off-by: Justus Winter <[email protected]>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/gpgscm/scheme.c | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/tests/gpgscm/scheme.c b/tests/gpgscm/scheme.c index fbc562d97..3c7afa3bd 100644 --- a/tests/gpgscm/scheme.c +++ b/tests/gpgscm/scheme.c @@ -4355,7 +4355,6 @@ static pointer opexe_2(scheme *sc, enum scheme_opcodes op) { char *str; int index0; int index1; - int len; str=strvalue(car(sc->args)); @@ -4374,13 +4373,8 @@ static pointer opexe_2(scheme *sc, enum scheme_opcodes op) { index1=strlength(car(sc->args)); } - len=index1-index0; gc_disable(sc, 1); - x=mk_empty_string(sc,len,' '); - memcpy(strvalue(x),str+index0,len); - strvalue(x)[len]=0; - - s_return_enable_gc(sc, x); + s_return_enable_gc(sc, mk_counted_string(sc, str + index0, index1 - index0)); } CASE(OP_VECTOR): { /* vector */ |