Browse Source

+ ansistring version of strpnew()

git-svn-id: trunk@20827 -
Jonas Maebe 13 years ago
parent
commit
8a35bb090a
1 changed files with 11 additions and 0 deletions
  1. 11 0
      compiler/cutils.pas

+ 11 - 0
compiler/cutils.pas

@@ -114,6 +114,7 @@ interface
        to that mem
        to that mem
     }
     }
     function  strpnew(const s : string) : pchar;
     function  strpnew(const s : string) : pchar;
+    function  strpnew(const s : ansistring) : pchar;
 
 
     {# makes the character @var(c) lowercase, with spanish, french and german
     {# makes the character @var(c) lowercase, with spanish, french and german
        character set
        character set
@@ -800,6 +801,7 @@ implementation
         end;
         end;
     end;
     end;
 
 
+
     function octal_quote(const s:string;const qchars:Tcharset):string;
     function octal_quote(const s:string;const qchars:Tcharset):string;
 
 
     var i:byte;
     var i:byte;
@@ -1009,6 +1011,15 @@ implementation
          result:=p;
          result:=p;
       end;
       end;
 
 
+    function strpnew(const s: ansistring): pchar;
+      var
+         p : pchar;
+      begin
+        getmem(p,length(s)+1);
+        move(s[1],p^,length(s)+1);
+        result:=p;
+      end;
+
 
 
     procedure stringdispose(var p : pshortstring);{$ifdef USEINLINE}inline;{$endif}
     procedure stringdispose(var p : pshortstring);{$ifdef USEINLINE}inline;{$endif}
       begin
       begin