mirror of
git://git.gnupg.org/gnupg.git
synced 2025-04-17 15:44:34 +02:00
gpgscm: Simplify substring operation.
* tests/gpgscm/scheme.c (opexe_2): Simplify 'substring'. Signed-off-by: Justus Winter <justus@g10code.com>
This commit is contained in:
parent
685438bf6f
commit
d858096c99
@ -4355,7 +4355,6 @@ static pointer opexe_2(scheme *sc, enum scheme_opcodes op) {
|
|||||||
char *str;
|
char *str;
|
||||||
int index0;
|
int index0;
|
||||||
int index1;
|
int index1;
|
||||||
int len;
|
|
||||||
|
|
||||||
str=strvalue(car(sc->args));
|
str=strvalue(car(sc->args));
|
||||||
|
|
||||||
@ -4374,13 +4373,8 @@ static pointer opexe_2(scheme *sc, enum scheme_opcodes op) {
|
|||||||
index1=strlength(car(sc->args));
|
index1=strlength(car(sc->args));
|
||||||
}
|
}
|
||||||
|
|
||||||
len=index1-index0;
|
|
||||||
gc_disable(sc, 1);
|
gc_disable(sc, 1);
|
||||||
x=mk_empty_string(sc,len,' ');
|
s_return_enable_gc(sc, mk_counted_string(sc, str + index0, index1 - index0));
|
||||||
memcpy(strvalue(x),str+index0,len);
|
|
||||||
strvalue(x)[len]=0;
|
|
||||||
|
|
||||||
s_return_enable_gc(sc, x);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CASE(OP_VECTOR): { /* vector */
|
CASE(OP_VECTOR): { /* vector */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user