]> granicus.if.org Git - yasm/commitdiff
Use xmalloc() instead of malloc().
authorPeter Johnson <peter@tortall.net>
Thu, 4 Oct 2001 03:59:07 +0000 (03:59 -0000)
committerPeter Johnson <peter@tortall.net>
Thu, 4 Oct 2001 03:59:07 +0000 (03:59 -0000)
svn path=/trunk/yasm/; revision=265

libyasm/bitvect.c
src/bitvect.c

index ca391ff543a224b372d58cd100dff2909c5f44cf..7534663975d50ef6839eb0ebde4d69b5fdf9fa82 100644 (file)
@@ -286,7 +286,7 @@ ErrCode BitVector_Boot(void)
     FACTOR = LOGBITS - 3;  /* ld(BITS / 8) = ld(BITS) - ld(8) = ld(BITS) - 3 */
     MSB = (LSB << MODMASK);
 
-    BITMASKTAB = (wordptr) malloc((size_t) (BITS << FACTOR));
+    BITMASKTAB = (wordptr) xmalloc((size_t) (BITS << FACTOR));
 
     if (BITMASKTAB == NULL) return(ErrCode_Null);
 
@@ -345,7 +345,7 @@ wordptr BitVector_Create(N_int bits, boolean clear)         /* malloc        */
     size = BitVector_Size(bits);
     mask = BitVector_Mask(bits);
     bytes = (size + BIT_VECTOR_HIDDEN_WORDS) << FACTOR;
-    addr = (wordptr) malloc((size_t) bytes);
+    addr = (wordptr) xmalloc((size_t) bytes);
     if (addr != NULL)
     {
         *addr++ = bits;
@@ -426,7 +426,7 @@ wordptr BitVector_Resize(wordptr oldaddr, N_int bits)       /* realloc       */
     else
     {
         bytes = (newsize + BIT_VECTOR_HIDDEN_WORDS) << FACTOR;
-        newaddr = (wordptr) malloc((size_t) bytes);
+        newaddr = (wordptr) xmalloc((size_t) bytes);
         if (newaddr != NULL)
         {
             *newaddr++ = bits;
@@ -1317,7 +1317,7 @@ charptr BitVector_to_Hex(wordptr addr)
 
     length = bits >> 2;
     if (bits AND 0x0003) length++;
-    string = (charptr) malloc((size_t) (length+1));
+    string = (charptr) xmalloc((size_t) (length+1));
     if (string == NULL) return(NULL);
     string += length;
     *string = (N_char) '\0';
@@ -1388,7 +1388,7 @@ charptr BitVector_to_Bin(wordptr addr)
     charptr string;
 
     length = bits_(addr);
-    string = (charptr) malloc((size_t) (length+1));
+    string = (charptr) xmalloc((size_t) (length+1));
     if (string == NULL) return(NULL);
     string += length;
     *string = (N_char) '\0';
@@ -1471,7 +1471,7 @@ charptr BitVector_to_Dec(wordptr addr)
 
     length = (N_word) (bits / 3.3);        /* digits = bits * ln(2) / ln(10) */
     length += 2; /* compensate for truncating & provide space for minus sign */
-    result = (charptr) malloc((size_t) (length+1));    /* remember the '\0'! */
+    result = (charptr) xmalloc((size_t) (length+1));   /* remember the '\0'! */
     if (result == NULL) return(NULL);
     string = result;
     sign = BitVector_Sign(addr);
@@ -1743,7 +1743,7 @@ charptr BitVector_to_Enum(wordptr addr)
         }
     }
     else length = 1;
-    string = (charptr) malloc((size_t) length);
+    string = (charptr) xmalloc((size_t) length);
     if (string == NULL) return(NULL);
     start = 0;
     comma = FALSE;
@@ -2752,7 +2752,7 @@ charptr BitVector_Block_Read(wordptr addr, N_intptr length)
 
     /* provide translation for independence of endian-ness: */
     *length = size << FACTOR;
-    buffer = (charptr) malloc((size_t) ((*length)+1));
+    buffer = (charptr) xmalloc((size_t) ((*length)+1));
     if (buffer == NULL) return(NULL);
     target = buffer;
     if (size > 0)
index ca391ff543a224b372d58cd100dff2909c5f44cf..7534663975d50ef6839eb0ebde4d69b5fdf9fa82 100644 (file)
@@ -286,7 +286,7 @@ ErrCode BitVector_Boot(void)
     FACTOR = LOGBITS - 3;  /* ld(BITS / 8) = ld(BITS) - ld(8) = ld(BITS) - 3 */
     MSB = (LSB << MODMASK);
 
-    BITMASKTAB = (wordptr) malloc((size_t) (BITS << FACTOR));
+    BITMASKTAB = (wordptr) xmalloc((size_t) (BITS << FACTOR));
 
     if (BITMASKTAB == NULL) return(ErrCode_Null);
 
@@ -345,7 +345,7 @@ wordptr BitVector_Create(N_int bits, boolean clear)         /* malloc        */
     size = BitVector_Size(bits);
     mask = BitVector_Mask(bits);
     bytes = (size + BIT_VECTOR_HIDDEN_WORDS) << FACTOR;
-    addr = (wordptr) malloc((size_t) bytes);
+    addr = (wordptr) xmalloc((size_t) bytes);
     if (addr != NULL)
     {
         *addr++ = bits;
@@ -426,7 +426,7 @@ wordptr BitVector_Resize(wordptr oldaddr, N_int bits)       /* realloc       */
     else
     {
         bytes = (newsize + BIT_VECTOR_HIDDEN_WORDS) << FACTOR;
-        newaddr = (wordptr) malloc((size_t) bytes);
+        newaddr = (wordptr) xmalloc((size_t) bytes);
         if (newaddr != NULL)
         {
             *newaddr++ = bits;
@@ -1317,7 +1317,7 @@ charptr BitVector_to_Hex(wordptr addr)
 
     length = bits >> 2;
     if (bits AND 0x0003) length++;
-    string = (charptr) malloc((size_t) (length+1));
+    string = (charptr) xmalloc((size_t) (length+1));
     if (string == NULL) return(NULL);
     string += length;
     *string = (N_char) '\0';
@@ -1388,7 +1388,7 @@ charptr BitVector_to_Bin(wordptr addr)
     charptr string;
 
     length = bits_(addr);
-    string = (charptr) malloc((size_t) (length+1));
+    string = (charptr) xmalloc((size_t) (length+1));
     if (string == NULL) return(NULL);
     string += length;
     *string = (N_char) '\0';
@@ -1471,7 +1471,7 @@ charptr BitVector_to_Dec(wordptr addr)
 
     length = (N_word) (bits / 3.3);        /* digits = bits * ln(2) / ln(10) */
     length += 2; /* compensate for truncating & provide space for minus sign */
-    result = (charptr) malloc((size_t) (length+1));    /* remember the '\0'! */
+    result = (charptr) xmalloc((size_t) (length+1));   /* remember the '\0'! */
     if (result == NULL) return(NULL);
     string = result;
     sign = BitVector_Sign(addr);
@@ -1743,7 +1743,7 @@ charptr BitVector_to_Enum(wordptr addr)
         }
     }
     else length = 1;
-    string = (charptr) malloc((size_t) length);
+    string = (charptr) xmalloc((size_t) length);
     if (string == NULL) return(NULL);
     start = 0;
     comma = FALSE;
@@ -2752,7 +2752,7 @@ charptr BitVector_Block_Read(wordptr addr, N_intptr length)
 
     /* provide translation for independence of endian-ness: */
     *length = size << FACTOR;
-    buffer = (charptr) malloc((size_t) ((*length)+1));
+    buffer = (charptr) xmalloc((size_t) ((*length)+1));
     if (buffer == NULL) return(NULL);
     target = buffer;
     if (size > 0)