Bläddra i källkod

* from Thomas Schatzl: changed result type of InstanceSize to PtrInt
* simplified some code
* small methods of tobject are now inlined

git-svn-id: trunk@1170 -

florian 20 år sedan
förälder
incheckning
0b3094fdde
2 ändrade filer med 7 tillägg och 7 borttagningar
  1. 4 4
      rtl/inc/objpas.inc
  2. 3 3
      rtl/inc/objpash.inc

+ 4 - 4
rtl/inc/objpas.inc

@@ -116,10 +116,10 @@
              self.destroy;
         end;
 
-      class function TObject.InstanceSize : LongInt;
+      class function TObject.InstanceSize : SizeInt;
 
         begin
-           InstanceSize:=plongint(pointer(self)+vmtInstanceSize)^;
+           InstanceSize:=pSizeInt(pointer(self)+vmtInstanceSize)^;
         end;
 
       procedure InitInterfacePointers(objclass: tclass;instance : pointer);
@@ -153,7 +153,7 @@
 
         begin
            { the size is saved at offset 0 }
-           fillchar(instance^,plongint(pointer(self)+vmtInstanceSize)^,0);
+           fillchar(instance^, InstanceSize, 0);
            { insert VMT pointer into the new created memory area }
            { (in class methods self contains the VMT!)           }
            ppointer(instance)^:=pointer(self);
@@ -175,7 +175,7 @@
            p : pointer;
 
         begin
-           getmem(p,plongint(pointer(self)+vmtInstanceSize)^);
+           getmem(p, InstanceSize);
            if p <> nil then
               InitInstance(p);
            NewInstance:=TObject(p);

+ 3 - 3
rtl/inc/objpash.inc

@@ -127,12 +127,12 @@
           procedure Free;
           class function InitInstance(instance : pointer) : tobject;
           procedure CleanupInstance;
-          class function ClassType : tclass;
+          class function ClassType : tclass;{$ifdef SYSTEMINLINE}inline;{$endif}
           class function ClassInfo : pointer;
           class function ClassName : shortstring;
           class function ClassNameIs(const name : string) : boolean;
-          class function ClassParent : tclass;
-          class function InstanceSize : longint;
+          class function ClassParent : tclass;{$ifdef SYSTEMINLINE}inline;{$endif}
+          class function InstanceSize : SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif}
           class function InheritsFrom(aclass : tclass) : boolean;
           class function StringMessageTable : pstringmessagetable;
           { message handling routines }