Browse Source

* freeandnil added

peter 24 years ago
parent
commit
d1d438367f
3 changed files with 25 additions and 5 deletions
  1. 5 1
      rtl/inc/objpash.inc
  2. 6 3
      rtl/objpas/sysutilh.inc
  3. 14 1
      rtl/objpas/sysutils.inc

+ 5 - 1
rtl/inc/objpash.inc

@@ -155,6 +155,7 @@
          function _AddRef : longint;stdcall;
          function _AddRef : longint;stdcall;
          function _Release : longint;stdcall;
          function _Release : longint;stdcall;
        end;
        end;
+       IInterface = IUnknown;
 
 
        { for native dispinterface support }
        { for native dispinterface support }
        IDispatch = interface(IUnknown)
        IDispatch = interface(IUnknown)
@@ -279,7 +280,10 @@
        end;
        end;
 {
 {
   $Log$
   $Log$
-  Revision 1.11  2001-04-13 23:49:48  peter
+  Revision 1.12  2001-08-12 22:11:48  peter
+    * freeandnil added
+
+  Revision 1.11  2001/04/13 23:49:48  peter
     * fixes for the stricter compiler
     * fixes for the stricter compiler
 
 
   Revision 1.10  2001/04/04 17:56:45  florian
   Revision 1.10  2001/04/04 17:56:45  florian

+ 6 - 3
rtl/objpas/sysutilh.inc

@@ -141,13 +141,16 @@ Type
   {$i filutilh.inc}
   {$i filutilh.inc}
 
 
   { Read disk function declarations }
   { Read disk function declarations }
-
-
   {$i diskh.inc}
   {$i diskh.inc}
 
 
+    procedure FreeAndNil(var obj);
+
 {
 {
   $Log$
   $Log$
-  Revision 1.9  2001-06-03 15:18:01  peter
+  Revision 1.10  2001-08-12 22:11:48  peter
+    * freeandnil added
+
+  Revision 1.9  2001/06/03 15:18:01  peter
     * eoutofmemory and einvalidpointer fix
     * eoutofmemory and einvalidpointer fix
 
 
   Revision 1.8  2001/02/20 22:14:19  peter
   Revision 1.8  2001/02/20 22:14:19  peter

+ 14 - 1
rtl/objpas/sysutils.inc

@@ -38,6 +38,16 @@
   {$i syspch.inc}
   {$i syspch.inc}
 
 
 
 
+    procedure FreeAndNil(var obj);
+      var
+        temp: tobject;
+      begin
+        temp:=tobject(obj);
+        pointer(obj):=nil;
+        temp.free;
+      end;
+
+
     constructor Exception.Create(const msg : string);
     constructor Exception.Create(const msg : string);
 
 
       begin
       begin
@@ -308,7 +318,10 @@ end;
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.4  2001-06-03 15:18:01  peter
+  Revision 1.5  2001-08-12 22:11:48  peter
+    * freeandnil added
+
+  Revision 1.4  2001/06/03 15:18:01  peter
     * eoutofmemory and einvalidpointer fix
     * eoutofmemory and einvalidpointer fix
 
 
   Revision 1.3  2000/11/23 11:04:26  sg
   Revision 1.3  2000/11/23 11:04:26  sg