mirror of
				https://gitlab.com/freepascal.org/fpc/source.git
				synced 2025-10-31 08:11:29 +01:00 
			
		
		
		
	* shortstring reuse fixed
This commit is contained in:
		
							parent
							
								
									57b01570ba
								
							
						
					
					
						commit
						6fa76bfc12
					
				| @ -147,7 +147,7 @@ implementation | |||||||
|          lastlabel   : plabel; |          lastlabel   : plabel; | ||||||
|          pc          : pchar; |          pc          : pchar; | ||||||
|          same_string : boolean; |          same_string : boolean; | ||||||
|          l, |          l,j, | ||||||
|          i,mylength  : longint; |          i,mylength  : longint; | ||||||
|       begin |       begin | ||||||
|          lastlabel:=nil; |          lastlabel:=nil; | ||||||
| @ -176,16 +176,34 @@ implementation | |||||||
|                            (pai_string(hp1)^.len=mylength) then |                            (pai_string(hp1)^.len=mylength) then | ||||||
|                           begin |                           begin | ||||||
|                              same_string:=true; |                              same_string:=true; | ||||||
|  |                              { if shortstring then check the length byte first and | ||||||
|  |                                set the start index to 1 } | ||||||
|  |                              if is_shortstring(p^.resulttype) then | ||||||
|  |                               begin | ||||||
|  |                                 if p^.length<>ord(pai_string(hp1)^.str[0]) then | ||||||
|  |                                  same_string:=false; | ||||||
|  |                                 j:=1; | ||||||
|  |                               end | ||||||
|  |                              else | ||||||
|  |                               j:=0; | ||||||
|  |                              { don't check if the length byte was already wrong } | ||||||
|  |                              if same_string then | ||||||
|  |                               begin | ||||||
|                                 for i:=0 to p^.length do |                                 for i:=0 to p^.length do | ||||||
|                                if pai_string(hp1)^.str[i]<>p^.value_str[i] then |                                  begin | ||||||
|  |                                    if pai_string(hp1)^.str[j]<>p^.value_str[i] then | ||||||
|                                     begin |                                     begin | ||||||
|                                       same_string:=false; |                                       same_string:=false; | ||||||
|                                       break; |                                       break; | ||||||
|                                     end; |                                     end; | ||||||
|  |                                    inc(j); | ||||||
|  |                                  end; | ||||||
|  |                               end; | ||||||
|  |                              { found ? } | ||||||
|                              if same_string then |                              if same_string then | ||||||
|                               begin |                               begin | ||||||
|                                   { found! } |  | ||||||
|                                 p^.lab_str:=lastlabel; |                                 p^.lab_str:=lastlabel; | ||||||
|  |                                 { create a new entry for ansistrings, but reuse the data } | ||||||
|                                 if (p^.stringtype in [st_ansistring,st_widestring]) then |                                 if (p^.stringtype in [st_ansistring,st_widestring]) then | ||||||
|                                  begin |                                  begin | ||||||
|                                    getdatalabel(l2); |                                    getdatalabel(l2); | ||||||
| @ -384,7 +402,10 @@ implementation | |||||||
| end. | end. | ||||||
| { | { | ||||||
|   $Log$ |   $Log$ | ||||||
|   Revision 1.29  1999-02-25 21:02:25  peter |   Revision 1.30  1999-03-31 13:51:49  peter | ||||||
|  |     * shortstring reuse fixed | ||||||
|  | 
 | ||||||
|  |   Revision 1.29  1999/02/25 21:02:25  peter | ||||||
|     * ag386bin updates |     * ag386bin updates | ||||||
|     + coff writer |     + coff writer | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 peter
						peter