2
0

fpcfunctions.inc 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. procedure fpcxmlFree(mem: pointer); EXTDECL;
  2. begin
  3. FreeMem(mem);
  4. end;
  5. function fpcxmlMalloc(size: csize_t): pointer; EXTDECL;
  6. begin
  7. GetMem(Result, size);
  8. end;
  9. function fpcxmlRealloc(mem: pointer; size: csize_t): pointer; EXTDECL;
  10. begin
  11. Result := mem;
  12. ReallocMem(Result, size);
  13. end;
  14. function fpcxmlStrdup(str: PAnsiChar): PAnsiChar; EXTDECL;
  15. var
  16. L: SizeInt;
  17. begin
  18. L := Length(str) + 1;
  19. Getmem(Result, L);
  20. if Result <> nil then
  21. Move(str^, Result^, L);
  22. end;
  23. procedure fpcxmlStructuredErrorHandler(userData: pointer; error: xmlErrorPtr); EXTDECL;
  24. begin
  25. writeln('struct error');
  26. end;
  27. {$IFDEF NO_EXTERNAL_VARS}
  28. function GetxmlMalloc: xmlMallocFunc; inline;
  29. begin
  30. Result := varxmlMalloc^;
  31. end;
  32. procedure SetxmlMalloc(AValue: xmlMallocFunc); inline;
  33. begin
  34. varxmlMalloc^ := AValue;
  35. end;
  36. function GetxmlMallocAtomic: xmlMallocFunc; inline;
  37. begin
  38. Result := varxmlMallocAtomic^;
  39. end;
  40. procedure SetxmlMallocAtomic(AValue: xmlMallocFunc); inline;
  41. begin
  42. varxmlMallocAtomic^ := AValue;
  43. end;
  44. function GetxmlRealloc: xmlReallocFunc; inline;
  45. begin
  46. Result := varxmlRealloc^;
  47. end;
  48. procedure SetxmlRealloc(AValue: xmlReallocFunc); inline;
  49. begin
  50. varxmlRealloc^ := AValue;
  51. end;
  52. function GetxmlFree: xmlFreeFunc; inline;
  53. begin
  54. Result := varxmlFree^;
  55. end;
  56. procedure SetxmlFree(AValue: xmlFreeFunc); inline;
  57. begin
  58. varxmlFree^ := AValue;
  59. end;
  60. function GetxmlMemStrdup: xmlStrdupFunc; inline;
  61. begin
  62. Result := varxmlMemStrdup^;
  63. end;
  64. procedure SetxmlMemStrdup(AValue: xmlStrdupFunc); inline;
  65. begin
  66. varxmlMemStrdup^ := AValue;
  67. end;
  68. {$ENDIF}