--- 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!