<commit_before>/*
farrtl.cpp

८। 㭪権 ࠡ  : new/delete/malloc/realloc/free
*/

/* Revision: 1.01 04.07.2000 $ */

/*
Modify:
  03.07.2000 IS
    ! 祭 ᥣ 䠩  ஥
  04.07.2000 SVS
    ! 뤥  ⢥ ᠬ筮 !
*/

#ifdef __cplusplus
extern "C" {
#endif
typedef unsigned size_t;

void *malloc(size_t size);
void *realloc(void *block, size_t size);
void free(void *block);

#ifdef __cplusplus
}
#endif

#include "headers.hpp"
#pragma hdrstop

static HANDLE FARHeapForNew=NULL;

void *malloc(size_t size)
{
  if(!FARHeapForNew) FARHeapForNew=GetProcessHeap();
  return HeapAlloc(FARHeapForNew?FARHeapForNew:GetProcessHeap(),HEAP_ZERO_MEMORY,size);
}

void *realloc(void *block, size_t size)
{
  if(!FARHeapForNew) FARHeapForNew=GetProcessHeap();
  if (block) return HeapReAlloc(FARHeapForNew?FARHeapForNew:GetProcessHeap(),HEAP_ZERO_MEMORY,block,size);
  else return HeapAlloc(FARHeapForNew?FARHeapForNew:GetProcessHeap(),HEAP_ZERO_MEMORY, size);
}

void free(void *block)
{
  if(!FARHeapForNew) FARHeapForNew=GetProcessHeap();
  HeapFree(FARHeapForNew?FARHeapForNew:GetProcessHeap(),0,block);
}

void *operator new(size_t sz) {return malloc(sz);}
void operator delete(void *v) {free(v);}
void *operator new[](size_t sz) {return malloc(sz);}
void operator delete[](void *v) {free(v);}
<commit_msg>FAR patch 00033.farrtl.cpp Дата              : 05.07.2000 Сделал            : <NAME> Описание          : Добавил кучу проверок Измененные файлы  : farrtl.cpp.33.diff Состав            : farrtl.cpp.33.diff                     00033.farrtl.cpp.txt Основан на патче  : 27 Дополнение        :<commit_after>/*
farrtl.cpp

८। 㭪権 ࠡ  : new/delete/malloc/realloc/free
*/

/* Revision: 1.02 05.07.2000 $ */

/*
Modify:
  03.07.2000 IS
    ! 祭 ᥣ 䠩  ஥
  04.07.2000 SVS
    ! 뤥  ⢥ ᠬ筮 !
  05.07.2000 IS
    !   ஢ப,   ᠫ ,    ࠢ
      , ᫨ ८। new/delete :-(((
*/

#ifdef __cplusplus
extern "C" {
#endif
typedef unsigned size_t;

void *malloc(size_t size);
void *realloc(void *block, size_t size);
void free(void *block);

#ifdef __cplusplus
}
#endif

#include "headers.hpp"
#pragma hdrstop

static HANDLE FARHeapForNew=NULL;

void *malloc(size_t size)
{
  void *p;
  if(!FARHeapForNew) FARHeapForNew=GetProcessHeap();
  if(FARHeapForNew) p=HeapAlloc(FARHeapForNew,HEAP_ZERO_MEMORY,size);
//  if(p==NULL)MessageBox(NULL,"NULL","p",0);
  return p;
}

void *realloc(void *block, size_t size)
{
  void *p;
  if(!FARHeapForNew) FARHeapForNew=GetProcessHeap();
  if(FARHeapForNew)
   {
    if (block) p=HeapReAlloc(FARHeapForNew,HEAP_ZERO_MEMORY,block,size);
    else p=HeapAlloc(FARHeapForNew,HEAP_ZERO_MEMORY, size);
   }
//  if(p==NULL)MessageBox(NULL,"NULL","p",0);
  return p;
}

void free(void *block)
{
  if(!FARHeapForNew) FARHeapForNew=GetProcessHeap();
  if(FARHeapForNew) HeapFree(FARHeapForNew,0,block);
}

#if 0 //  ⮣ ࠡ⠥,      稭
void *operator new(size_t sz)
 {
  extern new_handler _new_handler;
  void *p;
  sz=sz?sz:1;
  while((p=malloc(sz))==NULL)
   {
    if(_new_handler!=NULL)_new_handler();
    else break;
   }
  return p;
 }
void operator delete(void *v)
 {
  if(v)free(v);
 }
void *operator new[](size_t sz)
 {
  extern new_handler _new_handler;
  void *p;
  sz=sz?sz:1;
  while((p=malloc(sz))==NULL)
   {
    if(_new_handler!=NULL)_new_handler();
    else break;
   }
  return p;
 }
void operator delete[](void *v)
 {
  if(v)free(v);
 }
#endif

{'fraction_non_alphanumeric': 0.14871794871794872, 'fraction_numerical': 0.02895927601809955, 'mean_word_length': 4.078101071975498, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5236208', 'n_tokens_mistral': 1513, 'n_tokens_neox': 1484, 'n_words': 266}