[CLOSED] Code cleanup at procedure fpc_dynarray_setlength lazarus / 64-FPC development ---------------------------------------------------------------------- lagprogramming · 2024-02-08 11:37 procedure fpc_dynarray_setlength(var p : pointer;pti : pointer;   dimcount : sizeint;dims : pdynarrayindex);[Public,Alias:'FPC_DYNARR_SETLENGTH']; compilerproc; contains the following lines: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i ...newp:=ge tmem(size);fillchar(newp^,sizeof(tdynarray),0);...newp^.refcount:=1;ne wp^.high:=dims[0]-1;... Because Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i tdynarray = { packed } record  refcount : ptrint;  high : tdynarrayindex;end;the "fillchar(newp^,sizeof(tdynarray),0);" line is equivalent to "newp^.refcount:=0;newp^.high:=0;". Later in code we have "newp^.refcount:=1;newp^.high:=dims[0]-1;" which makes the presence of the fillchar line useless. The following patch removes the fillchar line. ---------------------------------------------------------------------- PascalDragon · 2024-02-08 20:11 Quote from: lagprogramming on February 08, 2024, 12:37:04 pmThe following patch removes the fillchar line. This is called safe programming in case the record should ever be extended and also to ensure that any potential padding bytes are cleared as well. ---------------------------------------------------------------------- d2010 · 2026-03-30 05:42 Please How to prefix conditional out-off-function? C:Q1=I need declare prefixCaller on outside of function , is inside all lines-with-caller? C:Q2=I need declare entire code of "Lista_variabilelor_locale" is totally depends by var-c2lisp_generate_namelist_of_localvars_from_setq?. Best regards.. My definition prefixCaller ==c2lisp_generate_namelist_of_localvars_from_setq If c2lisp_generate_namelist_of_localvars_from_setq<>1 then the function "Lista_variabilelor_locale" is totally not used. Tne Entire-code of "Lista_variabilelor_locale" depends too much variabile-switch c2lisp_generate_namelist_of_localvars_from_setq:integer=0; (== is good reason, ) That I need skip-all-callers of function  "Lista_variabilelor_locale". Best regards.. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Function Lista_variabilelor_locale(s185:string):boolean;  Var o109:Boolean;    nth,gap,dwg:integer;      t110,p110:pchar;    function OdSetLocale_h:boolean;              Begin                    result:=true;               End;  Begin      t110:=nil;      p110:=nil;      result:=false;      gap:=000;      if (length(s185)<01)or(s185[1]=#00) then exit;      result:=true;      o109:=((la=opl_SetQ)or(last_la=opl_unsconst));      if (length(s185)>2) and (s185[01]='$')and(s185[2]='$') then delete(s185,1,2);      Sho_lower(s185);      if (c2lisp_generate_namel ist_of_localvars_from_setq=1)and((length(s185)+2)00) then v_c2lisp_namelist_of_localvars_setqS:= v_c2lisp_namelist_of_localvars_setqS + s185+' ';              End;End;//off-Lista_variabilelor_locale("")--------------------------- ------------------------------------------  Function expr_all_setqOp:NavTree;var tr:NavTree;op:EnodeType; docec:word;Begin tr:=expr_else_pt_cond_semnalizat_de_pct_si_virgula; docec:=00;    while la=opl_Setq do               begin  op := laVal3.typ;                    if (length(laVal3.s)>0) then  Lista_variabilelor_locale(laVal3.s);                      if (trkzeropin)and(tr^.typ IN [ConstNd,SetqNd])and(length(tr^.soh)>02)an d(tr^.soh[1]='$')and(tr^.soh[2]='$')                          then tr^.typ:=op                          else tr:=makeNode_id0(op,tr,kNavtreeNil);                      LexiconManager(000);                      tr^.right:=expr_else_pt_cond_semnalizat_de_pct_si_virgula();            end;{while}            result:=tr;end;//off("asociativitate de la dreapta la stanga")  Function check_if_last_is_var(cc1,cc2,cc3,cc4:cha r;tokr:ENodeType):ENodeType;Begin            inc(pig);           la:=opl_setq;           if (last_la<>opl_unsconst)or(length(last_laVa l.s)<01)or(last_laVal.s[1]<>'$')              then begin dec(pig,2);             scho.q:='1234';               scho.q[1]:=cc1;             scho.q[2]:=cc2;               scho.q[3]:=cc3;               scho.q[4]:=cc4;                dfn_get_error('.eExpectedVariable for'+scho.q,000);              end;          if (length(laVal3.s)>0) then               lista_variabilelor_locale(laVal3.s);             {actualizare lista_var_defun}           if (tokr'+')and(cAsiHost20hdi.car[pi g]='=') then       Begin la:=opl_Setq; laVal3:=laOld; laVal3.strR:=00; laVal3.strL:=0;             inc(pig);             laVal3.typ:=AddEqNd;LaVal3.restype:=RT_NONE;             Exit;        End;  if (lef_or_right=2628)and(cAsiHost20hdi.car[pig]<>'+')and(cAsi Host20hdi.car[pig]='=') then       Begin la:=opl_Setq; laVal3:=laOld; laVal3.strR:=00; laVal3.strL:=0;             inc(pig);             laVal3.typ:=AddEqNd;LaVal3.restype:=RT_NONE;             Exit;        End;  if (lef_or_right=2628)and(cAsiHost20hdi.car[pig]<>'+') then     Begin la:=opl_addo; laVal3:=laOld; laVal3.strR:=00; laVal3.strL:=0;             laVal3.typ:=PlusNd;LaVal3.restype:=RT_NONE;             Exit;        End;       if (length(laVal3.s)>0) then  lista_variabilelor_locale(laVal3.s);          Case cAsiHost20hdi.car[pig] of'+':begin inc(pig);      if (la13=opl_unsconst)and(laOld.resType=RT_ATOMVAR) then opentok:=02 else        Begin LexiconManager(225);             if (la=opl_unsconst)and(laVal3.resType=RT_ATOMVAR) then opentok:=01;      End;      Case opentok of01: Begin la:=opl_Unary;laVal3.strR:=00; laVal3.strL:=0;           laVal3.typ:=incrementNd;LaVal3.restype:=RT_DECPOST; End; //off(" ++boca ")02: Begin la:=opl_Unary;laVal3:=laOld; laVal3.strR:=00; laVal3.strL:=0;         laVal3.typ:=incrementNd;LaVal3.restype:=RT_DECSUFX End; //off(" boca++ ")  else      dfn_get_error('eVap!t180errorA..eCannot use ++ without variabile name',0000);     end;   end;//case( "++");_'=':laVal 3.typ:=check_if_last_is_var('+=',laVal3.typ);'0'..'9':Begin if (la=opl_Lparen) then  Begin ParseNumberNegative(false); end else              Begin  la := opl_Addo;laVal3.typ:=PlusNd;End;         End;else Begin la := opl_AddO;laVal3.typ:=PlusNd;End;           end;{+,+=}End;