Commit Graph

102 Commits

Author SHA1 Message Date
Jim Monte 70e6318915 If the prompt variable was set to a value that is not a string, memory that has been freed would be used when displaying the command prompt. This could lead to strange prompts and possible access violations, although it may appear to work OK if the freed memory has not been modified. This issue is fixed. Some useless duplications of strings when defining variables are also removed. 2020-01-04 10:24:44 +01:00
Jim Monte ea81da2b01 [PATCH #55-1] Fixed some compiler warnings added by Visual Studio 2019 2019-08-13 23:29:13 +02:00
Holger Vogt bfe9e29580 If a in command set name="value" value is encapsulated in double quotes, it is always treated as a string variable. 2019-08-13 23:16:37 +02:00
Holger Vogt d636f7899b cp_enqvar() returns freshly malloced variables as well
as variables owned by somebody else, e.g. from ft_curckt->ci_vars.
The new function parameter tbfreed notifies the caller if the
variable is malloced here and may be freed safely.
2018-10-13 18:19:31 +02:00
dwarning aa95da431a adaptive format specifier for size_t printf 2018-08-22 14:19:12 +02:00
Holger Vogt dc34632421 fix memory leaks when evaluating a variable
MC example file MC_ring_ts.sp is now free of memory leaks
2018-08-07 22:46:26 +02:00
Holger Vogt 09c876550f prevent string overflow by adding the string length
to the cp_getvar parameters. Used only with CP_STRING
2018-07-22 14:57:49 +02:00
Holger Vogt a98d01e5f8 Use only internal memory functions, replace
free->tfree, malloc->tmalloc, realloc->trealloc
2018-07-21 23:54:43 +02:00
rlar 939555115d variables, cp_vprint, fix a memory leak 2016-10-15 15:57:59 +02:00
rlar bc325b17c5 variables, lift plot_cur->pl_env up to the invoker of cp_usrvars() 2016-10-15 15:57:54 +02:00
rlar e0db4aa665 variables, cp_vprint(), reorder for similarity 2016-10-15 15:57:52 +02:00
rlar a33876ff59 variables, variables, cp_getvar, rewrite 2016-10-15 15:57:50 +02:00
rlar 97c5e1567f variables, cp_getvar(), beware of retval == NULL 2016-10-15 15:57:48 +02:00
rlar 20b666e2d5 variables, clean up 2016-10-15 15:57:45 +02:00
rlar b2fb4e20bf variables, drop 'found', use identity found == (*p != NULL) 2016-10-15 15:57:43 +02:00
rlar 0784f76e51 variables, cleanup the for loops 2016-10-15 15:57:40 +02:00
rlar e39119c1c8 variables, use identity v == *p (and u == *p) 2016-10-15 15:57:38 +02:00
rlar d14ee053d7 variables, use a pointer to the anchor of the variable instead of 'lv' 2016-10-15 15:57:35 +02:00
rlar b13125ac84 variables, explicit processing of ft_curckt->ci_vars, drop uv2 2016-10-15 15:57:33 +02:00
rlar 7483ff9d8c variables, cp_remvar(), cleanup 2016-10-15 15:57:30 +02:00
rlar 485fba7548 variables, add some comments, add explicit case US_NOSIMVAR 2016-10-15 15:57:28 +02:00
rlar 97cdaae19f variables, cp_usrvars(), be more explicit
lift uv2 return value up to the invoker of cp_usrvars()
2016-10-15 15:57:26 +02:00
rlar 596599492e variables, drop redundant tfree(v->va_name), rely on free_struct_variable() 2016-10-15 15:57:23 +02:00
h_vogt fe24b3e6dd variable.c, remove memory leaks 2016-10-15 15:57:19 +02:00
rlar d32968bdaa variable.h, reduce visibility of auxiliary struct xxx to variable.c 2016-10-15 15:06:16 +02:00
rlar 141ed61ec8 use memcpy() instead of deprecated bcopy() 2016-07-30 20:58:19 +02:00
h_vogt 8480898399 frontend/variable.c, remove memory leak 2016-04-01 17:40:17 +02:00
rlar ac726f0cf4 struct variable, #18/18, clean 2016-04-01 17:39:53 +02:00
rlar a6cd5eea45 struct variable, #17/18, clean 2016-04-01 17:39:22 +02:00
rlar 212121d373 struct variable, #15/18, rewrite in terms of `var_alloc_xxx()' (do-3) 2016-04-01 17:36:57 +02:00
rlar 57f56f53a6 struct variable, #14/18, introduce `var_alloc_xxx()' 2016-04-01 17:34:55 +02:00
rlar bf5acda362 struct variable, #13/18, reorder var_alloc() invocation 2016-04-01 17:34:25 +02:00
rlar eb53b4d703 struct variable, #12/18, rewrite in terms of `var_alloc()' (do-2) 2016-04-01 17:34:03 +02:00
rlar 8691368a81 struct variable, #11/18, introduce `var_alloc()' 2016-04-01 17:32:36 +02:00
rlar 68042b3d1b struct variable, #10/18, rewrite in terms of `var_set_xxx()' (do-1) 2016-04-01 17:32:12 +02:00
rlar bbbd531d8d struct variable, #9/18, introduce `var_set_xxx()' 2016-04-01 17:29:58 +02:00
rlar cc3a124120 struct variable, #8/18, collect struct variable operations 2016-04-01 17:29:36 +02:00
rlar 01a0449420 struct variable, #2/18, reorder struct variable field initialisation 2016-04-01 17:24:50 +02:00
rlar 1d15f6bfce fix struct variable initialisation 2016-04-01 17:22:07 +02:00
rlar 4c1c95e20f everywhere, use `TMALLOC()' instead of `alloc()' 2016-03-21 21:22:07 +01:00
rlar 71a7c3459b use char variants of the <ctype.h> isxxxx() family 2016-03-09 20:24:36 +01:00
rlar 07aba2e2ae frontend/variable.c, used `isalnum()' instead of homegrown `isalphanum()' 2016-03-09 20:24:36 +01:00
rlar 192eeadb0b remove crufty comments which where used to support broken text editors 2015-09-24 18:23:54 +02:00
rlar 5ac7858a79 rewrite, use tprintf 2015-03-28 20:10:29 +01:00
rlar ccc4c60d81 src/frontend/variable.c, swallow "warning: conversion to 'int' from 'size_t' may change the sign of the result" 2015-01-04 20:37:16 +01:00
rlar d18d2a935c src/frontend/variable.c, rewrite `cp_variablesubst()' 2014-11-30 20:58:29 +01:00
rlar 33d33e9d50 src/frontend/variable.c, fix expansion of '$var' when $var is an empty list
test case:
 set foo = ( )
 set foo = ( $foo baz bar )
 echo $foo
2014-11-30 11:20:05 +01:00
h_vogt 23ffcbf7d1 variable.c: prevent buffer overflow by limiting variable output to BSIZE_SP characters 2014-01-11 16:24:11 +01:00
dwarning 54529d0e42 allow cshell $variable substitution with and without $&var 2013-12-31 16:19:12 +01:00
rlar 2555eeadef fix the csh-problem $foo[$bar] and $foo[$&baz] 2013-12-31 16:13:00 +01:00