displayString
authorStefan Vogel <sv@exept.de>
Tue, 02 Apr 2002 19:42:27 +0200
changeset 6484 9873553fcadc
parent 6483 ec599166f169
child 6485 ca1aa73a3f91
displayString Report failed size in MallocFailure
ExternalBytes.st
--- a/ExternalBytes.st	Tue Apr 02 17:39:24 2002 +0200
+++ b/ExternalBytes.st	Tue Apr 02 19:42:27 2002 +0200
@@ -1003,9 +1003,9 @@
     |addr addrString|
 
     (addr := self address) isNil ifTrue:[
-	addrString := '[free]'
+        addrString := '[free]'
     ] ifFalse:[
-	addrString := '[at:' , (self address printStringRadix:16) , ']'
+        addrString := '[', size printString, ' at:' , (self address printStringRadix:16), ']'
     ].
     ^ self class name , addrString
 
@@ -1056,23 +1056,23 @@
      */
 
     if (__INST(address_) == nil && __isSmallInteger(numberOfBytes)) {
-	nBytes = __smallIntegerVal(numberOfBytes);
-	if (nBytes > 0) {
-	    space = __stx_malloc(nBytes);
-	    if (space) {
-		__INST(address_) = (OBJ)space;
-		__INST(size) = numberOfBytes;
-		RETURN(self);
-	    } else {
-		mallocFailure = true;
-	    }
-	}
+        nBytes = __smallIntegerVal(numberOfBytes);
+        if (nBytes > 0) {
+            space = __stx_malloc(nBytes);
+            if (space) {
+                __INST(address_) = (OBJ)space;
+                __INST(size) = numberOfBytes;
+                RETURN(self);
+            } else {
+                mallocFailure = true;
+            }
+        }
     }
 %}.
     mallocFailure == true ifTrue:[
-	^ ObjectMemory mallocFailureSignal raiseRequest
+        ^ MallocFailure raiseRequestWith:numberOfBytes.
     ] ifFalse:[
-	self primitiveFailed.
+        self primitiveFailed.
     ].
 ! !
 
@@ -1133,38 +1133,38 @@
     char *__stx_realloc();
 
     if (__isSmallInteger(numberOfBytes)) {
-	nBytes = __smallIntegerVal(numberOfBytes);
-	if (nBytes > 0) {
-	    prevSpace = (char *)__INST(address_);
-	    if (prevSpace == (char *)nil)
-		prevSpace = 0;
-	    space = __stx_realloc(prevSpace, nBytes);
-	    if (space) {
-		__INST(address_) = (OBJ)space;
-		__INST(size) = numberOfBytes;
-		if (space == prevSpace) {
-		    /* same address, no re-registration */
-		    RETURN(self);
-		}
-		mallocStatus = true;
-	    } else {
-		mallocStatus = false;
-	    }
-	}
+        nBytes = __smallIntegerVal(numberOfBytes);
+        if (nBytes > 0) {
+            prevSpace = (char *)__INST(address_);
+            if (prevSpace == (char *)nil)
+                prevSpace = 0;  /* allocate from scratch */
+            space = __stx_realloc(prevSpace, nBytes);
+            if (space) {
+                __INST(address_) = (OBJ)space;
+                __INST(size) = numberOfBytes;
+                if (space == prevSpace) {
+                    /* same address, no re-registration */
+                    RETURN(self);
+                }
+                mallocStatus = true;
+            } else {
+                mallocStatus = false;
+            }
+        }
     }
 %}.
     mallocStatus == true ifTrue:[
-	Lobby registerChange:self.
+        Lobby registerChange:self.
     ] ifFalse:[mallocStatus == false ifTrue:[
-	^ ObjectMemory mallocFailureSignal raiseRequest
+        ^ MallocFailure raiseRequestWith:numberOfBytes.
     ] ifFalse:[
-	self primitiveFailed.
+        self primitiveFailed.
     ]].
 ! !
 
 !ExternalBytes class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/ExternalBytes.st,v 1.45 2002-04-02 15:39:24 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/ExternalBytes.st,v 1.46 2002-04-02 17:42:27 stefan Exp $'
 ! !
 ExternalBytes initialize!