/[mcrypt]/libmcrypt/lib/xmemory.c
ViewVC logotype

Diff of /libmcrypt/lib/xmemory.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by nmav, Mon May 22 13:07:52 2000 UTC revision 1.2 by nmav, Tue Jan 23 11:51:19 2001 UTC
# Line 57  void *mxmalloc(size_t size) Line 57  void *mxmalloc(size_t size)
57          if (x != NULL) {          if (x != NULL) {
58                  LOCKMEM(x, size);                  LOCKMEM(x, size);
59                  return x;                  return x;
         } else {  
                 sleep(1);  
                 x = malloc(size);  
                 if (x != NULL) {  
                         LOCKMEM(x, size);  
                         return x;  
                 } else {  
                         fprintf(stderr, ("Cannot allocate memory\n"));  
                         return NULL;  
                 }  
60          }          }
61            return NULL;
62  }  }
63    
64  void *mxcalloc(size_t nmemb, size_t size)  void *mxcalloc(size_t nmemb, size_t size)
# Line 78  void *mxcalloc(size_t nmemb, size_t size Line 69  void *mxcalloc(size_t nmemb, size_t size
69          if (x != NULL) {          if (x != NULL) {
70                  LOCKMEM(x, size);                  LOCKMEM(x, size);
71                  return x;                  return x;
         } else {  
                 sleep(1);  
                 x = calloc(nmemb, size);  
                 if (x != NULL) {  
                         LOCKMEM(x, size);  
                         return x;  
                 } else {  
                         fprintf(stderr, ("Cannot allocate memory\n"));  
                         return NULL;  
                 }  
72          }          }
73            return NULL;
74  }  }
75    
76  void *mxrealloc(void *ptr, size_t size)  void *mxrealloc(void *ptr, size_t size)
# Line 99  void *mxrealloc(void *ptr, size_t size) Line 81  void *mxrealloc(void *ptr, size_t size)
81          if (x != NULL) {          if (x != NULL) {
82                  LOCKMEM(x, size);                  LOCKMEM(x, size);
83                  return x;                  return x;
         } else {  
                 sleep(1);  
                 x = realloc(ptr, size);  
                 if (x != NULL) {  
                         LOCKMEM(x, size);  
                         return x;  
                 } else {  
                         fprintf(stderr, ("Cannot allocate memory\n"));  
                         return NULL;  
                 }  
84          }          }
85            return NULL;
86  }  }
87    
88    

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26