heroku-tokyotyrant 0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (340) hide show
  1. data/COPYING +504 -0
  2. data/README.rdoc +231 -0
  3. data/Rakefile +72 -0
  4. data/benchmarks/balancer.rb +101 -0
  5. data/benchmarks/bulk_db.rb +74 -0
  6. data/benchmarks/bulk_table.rb +87 -0
  7. data/benchmarks/db.rb +114 -0
  8. data/benchmarks/table.rb +161 -0
  9. data/ext/extconf.rb +43 -0
  10. data/ext/tokyo/bin/tcamgr +0 -0
  11. data/ext/tokyo/bin/tcamttest +0 -0
  12. data/ext/tokyo/bin/tcatest +0 -0
  13. data/ext/tokyo/bin/tcbmgr +0 -0
  14. data/ext/tokyo/bin/tcbmttest +0 -0
  15. data/ext/tokyo/bin/tcbtest +0 -0
  16. data/ext/tokyo/bin/tcfmgr +0 -0
  17. data/ext/tokyo/bin/tcfmttest +0 -0
  18. data/ext/tokyo/bin/tcftest +0 -0
  19. data/ext/tokyo/bin/tchmgr +0 -0
  20. data/ext/tokyo/bin/tchmttest +0 -0
  21. data/ext/tokyo/bin/tchtest +0 -0
  22. data/ext/tokyo/bin/tcrmgr +0 -0
  23. data/ext/tokyo/bin/tcrmttest +0 -0
  24. data/ext/tokyo/bin/tcrtest +0 -0
  25. data/ext/tokyo/bin/tctmgr +0 -0
  26. data/ext/tokyo/bin/tctmttest +0 -0
  27. data/ext/tokyo/bin/tcttest +0 -0
  28. data/ext/tokyo/bin/tcucodec +0 -0
  29. data/ext/tokyo/bin/tcumttest +0 -0
  30. data/ext/tokyo/bin/tcutest +0 -0
  31. data/ext/tokyo/bin/ttserver +0 -0
  32. data/ext/tokyo/bin/ttulmgr +0 -0
  33. data/ext/tokyo/bin/ttultest +0 -0
  34. data/ext/tokyo/include/tcadb.h +548 -0
  35. data/ext/tokyo/include/tcbdb.h +1101 -0
  36. data/ext/tokyo/include/tcfdb.h +858 -0
  37. data/ext/tokyo/include/tchdb.h +871 -0
  38. data/ext/tokyo/include/tcrdb.h +801 -0
  39. data/ext/tokyo/include/tctdb.h +1086 -0
  40. data/ext/tokyo/include/tculog.h +392 -0
  41. data/ext/tokyo/include/tcutil.h +4184 -0
  42. data/ext/tokyo/include/ttutil.h +494 -0
  43. data/ext/tokyo/lib/libtokyocabinet.9.4.0.dylib +0 -0
  44. data/ext/tokyo/lib/libtokyocabinet.9.dylib +0 -0
  45. data/ext/tokyo/lib/libtokyocabinet.a +0 -0
  46. data/ext/tokyo/lib/libtokyocabinet.dylib +0 -0
  47. data/ext/tokyo/lib/libtokyotyrant.3.22.0.dylib +0 -0
  48. data/ext/tokyo/lib/libtokyotyrant.3.dylib +0 -0
  49. data/ext/tokyo/lib/libtokyotyrant.a +0 -0
  50. data/ext/tokyo/lib/libtokyotyrant.dylib +0 -0
  51. data/ext/tokyo/lib/pkgconfig/tokyocabinet.pc +14 -0
  52. data/ext/tokyo/lib/pkgconfig/tokyotyrant.pc +14 -0
  53. data/ext/tokyo/lib/ttskeldir.bundle +0 -0
  54. data/ext/tokyo/lib/ttskelmock.bundle +0 -0
  55. data/ext/tokyo/lib/ttskelnull.bundle +0 -0
  56. data/ext/tokyo/lib/ttskelproxy.bundle +0 -0
  57. data/ext/tokyo/libexec/tcawmgr.cgi +0 -0
  58. data/ext/tokyo/sbin/ttservctl +163 -0
  59. data/ext/tokyo/share/man/man1/tcamgr.1 +97 -0
  60. data/ext/tokyo/share/man/man1/tcamttest.1 +35 -0
  61. data/ext/tokyo/share/man/man1/tcatest.1 +55 -0
  62. data/ext/tokyo/share/man/man1/tcbmgr.1 +125 -0
  63. data/ext/tokyo/share/man/man1/tcbmttest.1 +81 -0
  64. data/ext/tokyo/share/man/man1/tcbtest.1 +107 -0
  65. data/ext/tokyo/share/man/man1/tcfmgr.1 +98 -0
  66. data/ext/tokyo/share/man/man1/tcfmttest.1 +62 -0
  67. data/ext/tokyo/share/man/man1/tcftest.1 +73 -0
  68. data/ext/tokyo/share/man/man1/tchmgr.1 +110 -0
  69. data/ext/tokyo/share/man/man1/tchmttest.1 +85 -0
  70. data/ext/tokyo/share/man/man1/tchtest.1 +95 -0
  71. data/ext/tokyo/share/man/man1/tcrmgr.1 +164 -0
  72. data/ext/tokyo/share/man/man1/tcrmttest.1 +55 -0
  73. data/ext/tokyo/share/man/man1/tcrtest.1 +89 -0
  74. data/ext/tokyo/share/man/man1/tctmgr.1 +140 -0
  75. data/ext/tokyo/share/man/man1/tctmttest.1 +92 -0
  76. data/ext/tokyo/share/man/man1/tcttest.1 +105 -0
  77. data/ext/tokyo/share/man/man1/tcucodec.1 +162 -0
  78. data/ext/tokyo/share/man/man1/tcumttest.1 +41 -0
  79. data/ext/tokyo/share/man/man1/tcutest.1 +81 -0
  80. data/ext/tokyo/share/man/man1/ttserver.1 +84 -0
  81. data/ext/tokyo/share/man/man1/ttulmgr.1 +40 -0
  82. data/ext/tokyo/share/man/man1/ttultest.1 +16 -0
  83. data/ext/tokyo/share/man/man3/tcadb.3 +676 -0
  84. data/ext/tokyo/share/man/man3/tcbdb.3 +1355 -0
  85. data/ext/tokyo/share/man/man3/tcfdb.3 +975 -0
  86. data/ext/tokyo/share/man/man3/tchdb.3 +898 -0
  87. data/ext/tokyo/share/man/man3/tclist.3 +1 -0
  88. data/ext/tokyo/share/man/man3/tcmap.3 +1 -0
  89. data/ext/tokyo/share/man/man3/tcmdb.3 +1 -0
  90. data/ext/tokyo/share/man/man3/tcmpool.3 +1 -0
  91. data/ext/tokyo/share/man/man3/tcrdb.3 +1309 -0
  92. data/ext/tokyo/share/man/man3/tctdb.3 +1110 -0
  93. data/ext/tokyo/share/man/man3/tctree.3 +1 -0
  94. data/ext/tokyo/share/man/man3/tculog.3 +15 -0
  95. data/ext/tokyo/share/man/man3/tcutil.3 +4518 -0
  96. data/ext/tokyo/share/man/man3/tcxstr.3 +1 -0
  97. data/ext/tokyo/share/man/man3/tokyocabinet.3 +132 -0
  98. data/ext/tokyo/share/man/man3/ttutil.3 +14 -0
  99. data/ext/tokyo/share/man/man8/ttservctl.8 +37 -0
  100. data/ext/tokyo/share/tokyocabinet/COPYING +504 -0
  101. data/ext/tokyo/share/tokyocabinet/ChangeLog +1252 -0
  102. data/ext/tokyo/share/tokyocabinet/THANKS +12 -0
  103. data/ext/tokyo/share/tokyocabinet/doc/benchmark.pdf +0 -0
  104. data/ext/tokyo/share/tokyocabinet/doc/common.css +211 -0
  105. data/ext/tokyo/share/tokyocabinet/doc/icon16.png +0 -0
  106. data/ext/tokyo/share/tokyocabinet/doc/index.html +156 -0
  107. data/ext/tokyo/share/tokyocabinet/doc/index.ja.html +197 -0
  108. data/ext/tokyo/share/tokyocabinet/doc/logo-ja.png +0 -0
  109. data/ext/tokyo/share/tokyocabinet/doc/logo.png +0 -0
  110. data/ext/tokyo/share/tokyocabinet/doc/spex-en.html +7145 -0
  111. data/ext/tokyo/share/tokyocabinet/doc/spex-ja.html +7476 -0
  112. data/ext/tokyo/share/tokyocabinet/doc/tokyoproducts.pdf +0 -0
  113. data/ext/tokyo/share/tokyocabinet/doc/tokyoproducts.ppt +0 -0
  114. data/ext/tokyo/share/tokyotyrant/COPYING +504 -0
  115. data/ext/tokyo/share/tokyotyrant/ChangeLog +578 -0
  116. data/ext/tokyo/share/tokyotyrant/THANKS +15 -0
  117. data/ext/tokyo/share/tokyotyrant/doc/common.css +211 -0
  118. data/ext/tokyo/share/tokyotyrant/doc/index.html +79 -0
  119. data/ext/tokyo/share/tokyotyrant/doc/spex.html +2264 -0
  120. data/ext/tokyo/share/tokyotyrant/ext/mapreduce.lua +57 -0
  121. data/ext/tokyo/share/tokyotyrant/ext/queue.lua +55 -0
  122. data/ext/tokyo/share/tokyotyrant/ext/senatus.lua +532 -0
  123. data/ext/tokyo/share/tokyotyrant/ext/usherette.lua +438 -0
  124. data/ext/tokyo_tyrant.c +147 -0
  125. data/ext/tokyo_tyrant.h +48 -0
  126. data/ext/tokyo_tyrant_db.c +227 -0
  127. data/ext/tokyo_tyrant_db.h +8 -0
  128. data/ext/tokyo_tyrant_module.c +453 -0
  129. data/ext/tokyo_tyrant_module.h +10 -0
  130. data/ext/tokyo_tyrant_query.c +226 -0
  131. data/ext/tokyo_tyrant_query.h +9 -0
  132. data/ext/tokyo_tyrant_table.c +319 -0
  133. data/ext/tokyo_tyrant_table.h +8 -0
  134. data/ext/tokyocabinet-1.4.41/COPYING +504 -0
  135. data/ext/tokyocabinet-1.4.41/ChangeLog +1252 -0
  136. data/ext/tokyocabinet-1.4.41/Makefile.in +825 -0
  137. data/ext/tokyocabinet-1.4.41/README +38 -0
  138. data/ext/tokyocabinet-1.4.41/THANKS +12 -0
  139. data/ext/tokyocabinet-1.4.41/bros/Makefile +133 -0
  140. data/ext/tokyocabinet-1.4.41/bros/bdbtest.c +438 -0
  141. data/ext/tokyocabinet-1.4.41/bros/cdbtest.c +219 -0
  142. data/ext/tokyocabinet-1.4.41/bros/cmpsqltctest.c +186 -0
  143. data/ext/tokyocabinet-1.4.41/bros/gdbmtest.c +216 -0
  144. data/ext/tokyocabinet-1.4.41/bros/mapreporter +72 -0
  145. data/ext/tokyocabinet-1.4.41/bros/maptest.cc +677 -0
  146. data/ext/tokyocabinet-1.4.41/bros/ndbmtest.c +204 -0
  147. data/ext/tokyocabinet-1.4.41/bros/qdbmtest.c +375 -0
  148. data/ext/tokyocabinet-1.4.41/bros/reporter +141 -0
  149. data/ext/tokyocabinet-1.4.41/bros/result.xls +0 -0
  150. data/ext/tokyocabinet-1.4.41/bros/sdbmtest.c +204 -0
  151. data/ext/tokyocabinet-1.4.41/bros/sqltest.c +404 -0
  152. data/ext/tokyocabinet-1.4.41/bros/tctest.c +748 -0
  153. data/ext/tokyocabinet-1.4.41/bros/tdbtest.c +205 -0
  154. data/ext/tokyocabinet-1.4.41/configure +7402 -0
  155. data/ext/tokyocabinet-1.4.41/configure.in +362 -0
  156. data/ext/tokyocabinet-1.4.41/doc/benchmark.pdf +0 -0
  157. data/ext/tokyocabinet-1.4.41/doc/common.css +211 -0
  158. data/ext/tokyocabinet-1.4.41/doc/icon16.png +0 -0
  159. data/ext/tokyocabinet-1.4.41/doc/index.html +156 -0
  160. data/ext/tokyocabinet-1.4.41/doc/index.ja.html +197 -0
  161. data/ext/tokyocabinet-1.4.41/doc/logo-ja.png +0 -0
  162. data/ext/tokyocabinet-1.4.41/doc/logo.png +0 -0
  163. data/ext/tokyocabinet-1.4.41/doc/spex-en.html +7145 -0
  164. data/ext/tokyocabinet-1.4.41/doc/spex-ja.html +7476 -0
  165. data/ext/tokyocabinet-1.4.41/doc/tokyoproducts.pdf +0 -0
  166. data/ext/tokyocabinet-1.4.41/doc/tokyoproducts.ppt +0 -0
  167. data/ext/tokyocabinet-1.4.41/example/Makefile +113 -0
  168. data/ext/tokyocabinet-1.4.41/example/tcadbex.c +55 -0
  169. data/ext/tokyocabinet-1.4.41/example/tcbdbex.c +64 -0
  170. data/ext/tokyocabinet-1.4.41/example/tcfdbex.c +60 -0
  171. data/ext/tokyocabinet-1.4.41/example/tchdbex.c +60 -0
  172. data/ext/tokyocabinet-1.4.41/example/tctchat.c +97 -0
  173. data/ext/tokyocabinet-1.4.41/example/tctchat.tmpl +141 -0
  174. data/ext/tokyocabinet-1.4.41/example/tctdbex.c +85 -0
  175. data/ext/tokyocabinet-1.4.41/example/tctsearch.c +95 -0
  176. data/ext/tokyocabinet-1.4.41/example/tctsearch.tmpl +122 -0
  177. data/ext/tokyocabinet-1.4.41/example/tcutilex.c +77 -0
  178. data/ext/tokyocabinet-1.4.41/f.tsv +2 -0
  179. data/ext/tokyocabinet-1.4.41/lab/calccomp +118 -0
  180. data/ext/tokyocabinet-1.4.41/lab/datechange +56 -0
  181. data/ext/tokyocabinet-1.4.41/lab/diffcheck +45 -0
  182. data/ext/tokyocabinet-1.4.41/lab/htmltotsv +102 -0
  183. data/ext/tokyocabinet-1.4.41/lab/magic +19 -0
  184. data/ext/tokyocabinet-1.4.41/lab/printenv.cgi +27 -0
  185. data/ext/tokyocabinet-1.4.41/lab/stepcount +26 -0
  186. data/ext/tokyocabinet-1.4.41/lab/stopwatch +61 -0
  187. data/ext/tokyocabinet-1.4.41/lab/tabcheck +43 -0
  188. data/ext/tokyocabinet-1.4.41/lab/wgettsv +239 -0
  189. data/ext/tokyocabinet-1.4.41/lab/widthcheck +57 -0
  190. data/ext/tokyocabinet-1.4.41/man/htmltoman +104 -0
  191. data/ext/tokyocabinet-1.4.41/man/tcadb.3 +676 -0
  192. data/ext/tokyocabinet-1.4.41/man/tcamgr.1 +97 -0
  193. data/ext/tokyocabinet-1.4.41/man/tcamttest.1 +35 -0
  194. data/ext/tokyocabinet-1.4.41/man/tcatest.1 +55 -0
  195. data/ext/tokyocabinet-1.4.41/man/tcbdb.3 +1355 -0
  196. data/ext/tokyocabinet-1.4.41/man/tcbmgr.1 +125 -0
  197. data/ext/tokyocabinet-1.4.41/man/tcbmttest.1 +81 -0
  198. data/ext/tokyocabinet-1.4.41/man/tcbtest.1 +107 -0
  199. data/ext/tokyocabinet-1.4.41/man/tcfdb.3 +975 -0
  200. data/ext/tokyocabinet-1.4.41/man/tcfmgr.1 +98 -0
  201. data/ext/tokyocabinet-1.4.41/man/tcfmttest.1 +62 -0
  202. data/ext/tokyocabinet-1.4.41/man/tcftest.1 +73 -0
  203. data/ext/tokyocabinet-1.4.41/man/tchdb.3 +898 -0
  204. data/ext/tokyocabinet-1.4.41/man/tchmgr.1 +110 -0
  205. data/ext/tokyocabinet-1.4.41/man/tchmttest.1 +85 -0
  206. data/ext/tokyocabinet-1.4.41/man/tchtest.1 +95 -0
  207. data/ext/tokyocabinet-1.4.41/man/tclist.3 +1 -0
  208. data/ext/tokyocabinet-1.4.41/man/tcmap.3 +1 -0
  209. data/ext/tokyocabinet-1.4.41/man/tcmdb.3 +1 -0
  210. data/ext/tokyocabinet-1.4.41/man/tcmpool.3 +1 -0
  211. data/ext/tokyocabinet-1.4.41/man/tctdb.3 +1110 -0
  212. data/ext/tokyocabinet-1.4.41/man/tctmgr.1 +140 -0
  213. data/ext/tokyocabinet-1.4.41/man/tctmttest.1 +92 -0
  214. data/ext/tokyocabinet-1.4.41/man/tctree.3 +1 -0
  215. data/ext/tokyocabinet-1.4.41/man/tcttest.1 +105 -0
  216. data/ext/tokyocabinet-1.4.41/man/tcucodec.1 +162 -0
  217. data/ext/tokyocabinet-1.4.41/man/tcumttest.1 +41 -0
  218. data/ext/tokyocabinet-1.4.41/man/tcutest.1 +81 -0
  219. data/ext/tokyocabinet-1.4.41/man/tcutil.3 +4518 -0
  220. data/ext/tokyocabinet-1.4.41/man/tcxstr.3 +1 -0
  221. data/ext/tokyocabinet-1.4.41/man/tokyocabinet.3 +132 -0
  222. data/ext/tokyocabinet-1.4.41/md5.c +381 -0
  223. data/ext/tokyocabinet-1.4.41/md5.h +101 -0
  224. data/ext/tokyocabinet-1.4.41/myconf.c +493 -0
  225. data/ext/tokyocabinet-1.4.41/myconf.h +549 -0
  226. data/ext/tokyocabinet-1.4.41/tcadb.c +4339 -0
  227. data/ext/tokyocabinet-1.4.41/tcadb.h +548 -0
  228. data/ext/tokyocabinet-1.4.41/tcamgr.c +1019 -0
  229. data/ext/tokyocabinet-1.4.41/tcamttest.c +542 -0
  230. data/ext/tokyocabinet-1.4.41/tcatest.c +1845 -0
  231. data/ext/tokyocabinet-1.4.41/tcawmgr.c +482 -0
  232. data/ext/tokyocabinet-1.4.41/tcbdb.c +4180 -0
  233. data/ext/tokyocabinet-1.4.41/tcbdb.h +1101 -0
  234. data/ext/tokyocabinet-1.4.41/tcbmgr.c +1012 -0
  235. data/ext/tokyocabinet-1.4.41/tcbmttest.c +1810 -0
  236. data/ext/tokyocabinet-1.4.41/tcbtest.c +2586 -0
  237. data/ext/tokyocabinet-1.4.41/tcfdb.c +2746 -0
  238. data/ext/tokyocabinet-1.4.41/tcfdb.h +858 -0
  239. data/ext/tokyocabinet-1.4.41/tcfmgr.c +786 -0
  240. data/ext/tokyocabinet-1.4.41/tcfmttest.c +1220 -0
  241. data/ext/tokyocabinet-1.4.41/tcftest.c +1695 -0
  242. data/ext/tokyocabinet-1.4.41/tchdb.c +5153 -0
  243. data/ext/tokyocabinet-1.4.41/tchdb.h +871 -0
  244. data/ext/tokyocabinet-1.4.41/tchmgr.c +842 -0
  245. data/ext/tokyocabinet-1.4.41/tchmttest.c +1757 -0
  246. data/ext/tokyocabinet-1.4.41/tchtest.c +2129 -0
  247. data/ext/tokyocabinet-1.4.41/tctdb.c +6199 -0
  248. data/ext/tokyocabinet-1.4.41/tctdb.h +1086 -0
  249. data/ext/tokyocabinet-1.4.41/tctmgr.c +1241 -0
  250. data/ext/tokyocabinet-1.4.41/tctmttest.c +1563 -0
  251. data/ext/tokyocabinet-1.4.41/tcttest.c +2062 -0
  252. data/ext/tokyocabinet-1.4.41/tcucodec.c +1357 -0
  253. data/ext/tokyocabinet-1.4.41/tcumttest.c +578 -0
  254. data/ext/tokyocabinet-1.4.41/tcutest.c +1875 -0
  255. data/ext/tokyocabinet-1.4.41/tcutil.c +10528 -0
  256. data/ext/tokyocabinet-1.4.41/tcutil.h +4184 -0
  257. data/ext/tokyocabinet-1.4.41/tokyocabinet.idl +336 -0
  258. data/ext/tokyocabinet-1.4.41/tokyocabinet.pc.in +14 -0
  259. data/ext/tokyotyrant-1.1.39/COPYING +504 -0
  260. data/ext/tokyotyrant-1.1.39/ChangeLog +578 -0
  261. data/ext/tokyotyrant-1.1.39/Makefile.in +365 -0
  262. data/ext/tokyotyrant-1.1.39/README +38 -0
  263. data/ext/tokyotyrant-1.1.39/THANKS +15 -0
  264. data/ext/tokyotyrant-1.1.39/configure +6979 -0
  265. data/ext/tokyotyrant-1.1.39/configure.in +300 -0
  266. data/ext/tokyotyrant-1.1.39/doc/common.css +211 -0
  267. data/ext/tokyotyrant-1.1.39/doc/index.html +79 -0
  268. data/ext/tokyotyrant-1.1.39/doc/spex.html +2264 -0
  269. data/ext/tokyotyrant-1.1.39/example/Makefile +68 -0
  270. data/ext/tokyotyrant-1.1.39/example/httptest.pl +88 -0
  271. data/ext/tokyotyrant-1.1.39/example/mcftest.pl +39 -0
  272. data/ext/tokyotyrant-1.1.39/example/mctest.pl +43 -0
  273. data/ext/tokyotyrant-1.1.39/example/tcrdbex +0 -0
  274. data/ext/tokyotyrant-1.1.39/example/tcrdbex.c +49 -0
  275. data/ext/tokyotyrant-1.1.39/example/tcrdbex.o +0 -0
  276. data/ext/tokyotyrant-1.1.39/example/tcrdbtblex +0 -0
  277. data/ext/tokyotyrant-1.1.39/example/tcrdbtblex.c +79 -0
  278. data/ext/tokyotyrant-1.1.39/example/tcrdbtblex.o +0 -0
  279. data/ext/tokyotyrant-1.1.39/ext/mapreduce.lua +57 -0
  280. data/ext/tokyotyrant-1.1.39/ext/queue.lua +55 -0
  281. data/ext/tokyotyrant-1.1.39/ext/senatus.lua +532 -0
  282. data/ext/tokyotyrant-1.1.39/ext/usherette.lua +438 -0
  283. data/ext/tokyotyrant-1.1.39/lab/datechange +56 -0
  284. data/ext/tokyotyrant-1.1.39/lab/diffcheck +45 -0
  285. data/ext/tokyotyrant-1.1.39/lab/fibonacci.lua +20 -0
  286. data/ext/tokyotyrant-1.1.39/lab/footprint.lua +67 -0
  287. data/ext/tokyotyrant-1.1.39/lab/highlow.lua +88 -0
  288. data/ext/tokyotyrant-1.1.39/lab/killdualmaster +12 -0
  289. data/ext/tokyotyrant-1.1.39/lab/rundualmaster +38 -0
  290. data/ext/tokyotyrant-1.1.39/lab/stepcount +26 -0
  291. data/ext/tokyotyrant-1.1.39/lab/tabcheck +43 -0
  292. data/ext/tokyotyrant-1.1.39/lab/ushrtregister.pl +55 -0
  293. data/ext/tokyotyrant-1.1.39/lab/widthcheck +57 -0
  294. data/ext/tokyotyrant-1.1.39/man/htmltoman +100 -0
  295. data/ext/tokyotyrant-1.1.39/man/tcrdb.3 +1309 -0
  296. data/ext/tokyotyrant-1.1.39/man/tcrmgr.1 +164 -0
  297. data/ext/tokyotyrant-1.1.39/man/tcrmttest.1 +55 -0
  298. data/ext/tokyotyrant-1.1.39/man/tcrtest.1 +89 -0
  299. data/ext/tokyotyrant-1.1.39/man/tculog.3 +15 -0
  300. data/ext/tokyotyrant-1.1.39/man/ttservctl.8 +37 -0
  301. data/ext/tokyotyrant-1.1.39/man/ttserver.1 +84 -0
  302. data/ext/tokyotyrant-1.1.39/man/ttulmgr.1 +40 -0
  303. data/ext/tokyotyrant-1.1.39/man/ttultest.1 +16 -0
  304. data/ext/tokyotyrant-1.1.39/man/ttutil.3 +14 -0
  305. data/ext/tokyotyrant-1.1.39/myconf.c +169 -0
  306. data/ext/tokyotyrant-1.1.39/myconf.h +408 -0
  307. data/ext/tokyotyrant-1.1.39/scrext.c +2394 -0
  308. data/ext/tokyotyrant-1.1.39/scrext.h +96 -0
  309. data/ext/tokyotyrant-1.1.39/tcrdb.c +2637 -0
  310. data/ext/tokyotyrant-1.1.39/tcrdb.h +801 -0
  311. data/ext/tokyotyrant-1.1.39/tcrmgr.c +1559 -0
  312. data/ext/tokyotyrant-1.1.39/tcrmttest.c +915 -0
  313. data/ext/tokyotyrant-1.1.39/tcrtest.c +1542 -0
  314. data/ext/tokyotyrant-1.1.39/tculog.c +1211 -0
  315. data/ext/tokyotyrant-1.1.39/tculog.h +392 -0
  316. data/ext/tokyotyrant-1.1.39/tokyotyrant.idl +143 -0
  317. data/ext/tokyotyrant-1.1.39/tokyotyrant.pc.in +14 -0
  318. data/ext/tokyotyrant-1.1.39/ttservctl +163 -0
  319. data/ext/tokyotyrant-1.1.39/ttserver.c +3583 -0
  320. data/ext/tokyotyrant-1.1.39/ttskeldir.c +141 -0
  321. data/ext/tokyotyrant-1.1.39/ttskelmock.c +64 -0
  322. data/ext/tokyotyrant-1.1.39/ttskelnull.c +79 -0
  323. data/ext/tokyotyrant-1.1.39/ttskelproxy.c +74 -0
  324. data/ext/tokyotyrant-1.1.39/ttulmgr.c +266 -0
  325. data/ext/tokyotyrant-1.1.39/ttultest.c +371 -0
  326. data/ext/tokyotyrant-1.1.39/ttutil.c +1510 -0
  327. data/ext/tokyotyrant-1.1.39/ttutil.h +494 -0
  328. data/lib/tokyo_tyrant/balancer.rb +189 -0
  329. data/spec/ext.lua +4 -0
  330. data/spec/plu_db.rb +538 -0
  331. data/spec/spec.rb +1 -0
  332. data/spec/spec_base.rb +17 -0
  333. data/spec/start_tyrants.sh +36 -0
  334. data/spec/stop_tyrants.sh +9 -0
  335. data/spec/tokyo_tyrant_balancer_db_spec.rb +160 -0
  336. data/spec/tokyo_tyrant_balancer_table_spec.rb +177 -0
  337. data/spec/tokyo_tyrant_query_spec.rb +159 -0
  338. data/spec/tokyo_tyrant_spec.rb +254 -0
  339. data/spec/tokyo_tyrant_table_spec.rb +301 -0
  340. metadata +402 -0
@@ -0,0 +1,101 @@
1
+ /*
2
+ Copyright (C) 1999, 2002 Aladdin Enterprises. All rights reserved.
3
+
4
+ This software is provided 'as-is', without any express or implied
5
+ warranty. In no event will the authors be held liable for any damages
6
+ arising from the use of this software.
7
+
8
+ Permission is granted to anyone to use this software for any purpose,
9
+ including commercial applications, and to alter it and redistribute it
10
+ freely, subject to the following restrictions:
11
+
12
+ 1. The origin of this software must not be misrepresented; you must not
13
+ claim that you wrote the original software. If you use this software
14
+ in a product, an acknowledgment in the product documentation would be
15
+ appreciated but is not required.
16
+ 2. Altered source versions must be plainly marked as such, and must not be
17
+ misrepresented as being the original software.
18
+ 3. This notice may not be removed or altered from any source distribution.
19
+
20
+ L. Peter Deutsch
21
+ ghost@aladdin.com
22
+
23
+ */
24
+ /* $Id: md5.h,v 1.4 2002/04/13 19:20:28 lpd Exp $ */
25
+ /*
26
+ Independent implementation of MD5 (RFC 1321).
27
+
28
+ This code implements the MD5 Algorithm defined in RFC 1321, whose
29
+ text is available at
30
+ http://www.ietf.org/rfc/rfc1321.txt
31
+ The code is derived from the text of the RFC, including the test suite
32
+ (section A.5) but excluding the rest of Appendix A. It does not include
33
+ any code or documentation that is identified in the RFC as being
34
+ copyrighted.
35
+
36
+ The original and principal author of md5.h is L. Peter Deutsch
37
+ <ghost@aladdin.com>. Other authors are noted in the change history
38
+ that follows (in reverse chronological order):
39
+
40
+ 2002-04-13 lpd Removed support for non-ANSI compilers; removed
41
+ references to Ghostscript; clarified derivation from RFC 1321;
42
+ now handles byte order either statically or dynamically.
43
+ 1999-11-04 lpd Edited comments slightly for automatic TOC extraction.
44
+ 1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5);
45
+ added conditionalization for C++ compilation from Martin
46
+ Purschke <purschke@bnl.gov>.
47
+ 1999-05-03 lpd Original version.
48
+ */
49
+
50
+ #ifndef md5_INCLUDED
51
+ # define md5_INCLUDED
52
+
53
+ /*
54
+ * This package supports both compile-time and run-time determination of CPU
55
+ * byte order. If ARCH_IS_BIG_ENDIAN is defined as 0, the code will be
56
+ * compiled to run only on little-endian CPUs; if ARCH_IS_BIG_ENDIAN is
57
+ * defined as non-zero, the code will be compiled to run only on big-endian
58
+ * CPUs; if ARCH_IS_BIG_ENDIAN is not defined, the code will be compiled to
59
+ * run on either big- or little-endian CPUs, but will run slightly less
60
+ * efficiently on either one than if ARCH_IS_BIG_ENDIAN is defined.
61
+ */
62
+
63
+
64
+ /*
65
+ * hack to avoid conflict of application symbol names
66
+ */
67
+ #define md5_init _tc_md5_init
68
+ #define md5_append _tc_md5_append
69
+ #define md5_finish _tc_md5_finish
70
+
71
+
72
+
73
+ typedef unsigned char md5_byte_t; /* 8-bit byte */
74
+ typedef unsigned int md5_word_t; /* 32-bit word */
75
+
76
+ /* Define the state of the MD5 Algorithm. */
77
+ typedef struct md5_state_s {
78
+ md5_word_t count[2]; /* message length in bits, lsw first */
79
+ md5_word_t abcd[4]; /* digest buffer */
80
+ md5_byte_t buf[64]; /* accumulate block */
81
+ } md5_state_t;
82
+
83
+ #ifdef __cplusplus
84
+ extern "C"
85
+ {
86
+ #endif
87
+
88
+ /* Initialize the algorithm. */
89
+ void md5_init(md5_state_t *pms);
90
+
91
+ /* Append a string to the message. */
92
+ void md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes);
93
+
94
+ /* Finish the message and return the digest. */
95
+ void md5_finish(md5_state_t *pms, md5_byte_t digest[16]);
96
+
97
+ #ifdef __cplusplus
98
+ } /* end extern "C" */
99
+ #endif
100
+
101
+ #endif /* md5_INCLUDED */
@@ -0,0 +1,493 @@
1
+ /*************************************************************************************************
2
+ * System-dependent configurations of Tokyo Cabinet
3
+ * Copyright (C) 2006-2009 Mikio Hirabayashi
4
+ * This file is part of Tokyo Cabinet.
5
+ * Tokyo Cabinet is free software; you can redistribute it and/or modify it under the terms of
6
+ * the GNU Lesser General Public License as published by the Free Software Foundation; either
7
+ * version 2.1 of the License or any later version. Tokyo Cabinet is distributed in the hope
8
+ * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
9
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
10
+ * License for more details.
11
+ * You should have received a copy of the GNU Lesser General Public License along with Tokyo
12
+ * Cabinet; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
13
+ * Boston, MA 02111-1307 USA.
14
+ *************************************************************************************************/
15
+
16
+
17
+ #include "myconf.h"
18
+
19
+
20
+
21
+ /*************************************************************************************************
22
+ * common settings
23
+ *************************************************************************************************/
24
+
25
+
26
+ int _tc_dummy_cnt = 0;
27
+
28
+
29
+ int _tc_dummyfunc(void){
30
+ return 0;
31
+ }
32
+
33
+
34
+ int _tc_dummyfuncv(int a, ...){
35
+ return 0;
36
+ }
37
+
38
+
39
+
40
+ /*************************************************************************************************
41
+ * for ZLIB
42
+ *************************************************************************************************/
43
+
44
+
45
+ #if TCUSEZLIB
46
+
47
+
48
+ #include <zlib.h>
49
+
50
+ #define ZLIBBUFSIZ 8192
51
+
52
+
53
+ static char *_tc_deflate_impl(const char *ptr, int size, int *sp, int mode);
54
+ static char *_tc_inflate_impl(const char *ptr, int size, int *sp, int mode);
55
+ static unsigned int _tc_getcrc_impl(const char *ptr, int size);
56
+
57
+
58
+ char *(*_tc_deflate)(const char *, int, int *, int) = _tc_deflate_impl;
59
+ char *(*_tc_inflate)(const char *, int, int *, int) = _tc_inflate_impl;
60
+ unsigned int (*_tc_getcrc)(const char *, int) = _tc_getcrc_impl;
61
+
62
+
63
+ static char *_tc_deflate_impl(const char *ptr, int size, int *sp, int mode){
64
+ assert(ptr && size >= 0 && sp);
65
+ z_stream zs;
66
+ zs.zalloc = Z_NULL;
67
+ zs.zfree = Z_NULL;
68
+ zs.opaque = Z_NULL;
69
+ switch(mode){
70
+ case _TCZMRAW:
71
+ if(deflateInit2(&zs, 5, Z_DEFLATED, -15, 7, Z_DEFAULT_STRATEGY) != Z_OK)
72
+ return NULL;
73
+ break;
74
+ case _TCZMGZIP:
75
+ if(deflateInit2(&zs, 6, Z_DEFLATED, 15 + 16, 9, Z_DEFAULT_STRATEGY) != Z_OK)
76
+ return NULL;
77
+ break;
78
+ default:
79
+ if(deflateInit2(&zs, 6, Z_DEFLATED, 15, 8, Z_DEFAULT_STRATEGY) != Z_OK)
80
+ return NULL;
81
+ break;
82
+ }
83
+ int asiz = size + 16;
84
+ if(asiz < ZLIBBUFSIZ) asiz = ZLIBBUFSIZ;
85
+ char *buf;
86
+ if(!(buf = MYMALLOC(asiz))){
87
+ deflateEnd(&zs);
88
+ return NULL;
89
+ }
90
+ unsigned char obuf[ZLIBBUFSIZ];
91
+ int bsiz = 0;
92
+ zs.next_in = (unsigned char *)ptr;
93
+ zs.avail_in = size;
94
+ zs.next_out = obuf;
95
+ zs.avail_out = ZLIBBUFSIZ;
96
+ int rv;
97
+ while((rv = deflate(&zs, Z_FINISH)) == Z_OK){
98
+ int osiz = ZLIBBUFSIZ - zs.avail_out;
99
+ if(bsiz + osiz > asiz){
100
+ asiz = asiz * 2 + osiz;
101
+ char *swap;
102
+ if(!(swap = MYREALLOC(buf, asiz))){
103
+ MYFREE(buf);
104
+ deflateEnd(&zs);
105
+ return NULL;
106
+ }
107
+ buf = swap;
108
+ }
109
+ memcpy(buf + bsiz, obuf, osiz);
110
+ bsiz += osiz;
111
+ zs.next_out = obuf;
112
+ zs.avail_out = ZLIBBUFSIZ;
113
+ }
114
+ if(rv != Z_STREAM_END){
115
+ MYFREE(buf);
116
+ deflateEnd(&zs);
117
+ return NULL;
118
+ }
119
+ int osiz = ZLIBBUFSIZ - zs.avail_out;
120
+ if(bsiz + osiz + 1 > asiz){
121
+ asiz = asiz * 2 + osiz;
122
+ char *swap;
123
+ if(!(swap = MYREALLOC(buf, asiz))){
124
+ MYFREE(buf);
125
+ deflateEnd(&zs);
126
+ return NULL;
127
+ }
128
+ buf = swap;
129
+ }
130
+ memcpy(buf + bsiz, obuf, osiz);
131
+ bsiz += osiz;
132
+ buf[bsiz] = '\0';
133
+ if(mode == _TCZMRAW) bsiz++;
134
+ *sp = bsiz;
135
+ deflateEnd(&zs);
136
+ return buf;
137
+ }
138
+
139
+
140
+ static char *_tc_inflate_impl(const char *ptr, int size, int *sp, int mode){
141
+ assert(ptr && size >= 0 && sp);
142
+ z_stream zs;
143
+ zs.zalloc = Z_NULL;
144
+ zs.zfree = Z_NULL;
145
+ zs.opaque = Z_NULL;
146
+ switch(mode){
147
+ case _TCZMRAW:
148
+ if(inflateInit2(&zs, -15) != Z_OK) return NULL;
149
+ break;
150
+ case _TCZMGZIP:
151
+ if(inflateInit2(&zs, 15 + 16) != Z_OK) return NULL;
152
+ break;
153
+ default:
154
+ if(inflateInit2(&zs, 15) != Z_OK) return NULL;
155
+ break;
156
+ }
157
+ int asiz = size * 2 + 16;
158
+ if(asiz < ZLIBBUFSIZ) asiz = ZLIBBUFSIZ;
159
+ char *buf;
160
+ if(!(buf = MYMALLOC(asiz))){
161
+ inflateEnd(&zs);
162
+ return NULL;
163
+ }
164
+ unsigned char obuf[ZLIBBUFSIZ];
165
+ int bsiz = 0;
166
+ zs.next_in = (unsigned char *)ptr;
167
+ zs.avail_in = size;
168
+ zs.next_out = obuf;
169
+ zs.avail_out = ZLIBBUFSIZ;
170
+ int rv;
171
+ while((rv = inflate(&zs, Z_NO_FLUSH)) == Z_OK){
172
+ int osiz = ZLIBBUFSIZ - zs.avail_out;
173
+ if(bsiz + osiz >= asiz){
174
+ asiz = asiz * 2 + osiz;
175
+ char *swap;
176
+ if(!(swap = MYREALLOC(buf, asiz))){
177
+ MYFREE(buf);
178
+ inflateEnd(&zs);
179
+ return NULL;
180
+ }
181
+ buf = swap;
182
+ }
183
+ memcpy(buf + bsiz, obuf, osiz);
184
+ bsiz += osiz;
185
+ zs.next_out = obuf;
186
+ zs.avail_out = ZLIBBUFSIZ;
187
+ }
188
+ if(rv != Z_STREAM_END){
189
+ MYFREE(buf);
190
+ inflateEnd(&zs);
191
+ return NULL;
192
+ }
193
+ int osiz = ZLIBBUFSIZ - zs.avail_out;
194
+ if(bsiz + osiz >= asiz){
195
+ asiz = asiz * 2 + osiz;
196
+ char *swap;
197
+ if(!(swap = MYREALLOC(buf, asiz))){
198
+ MYFREE(buf);
199
+ inflateEnd(&zs);
200
+ return NULL;
201
+ }
202
+ buf = swap;
203
+ }
204
+ memcpy(buf + bsiz, obuf, osiz);
205
+ bsiz += osiz;
206
+ buf[bsiz] = '\0';
207
+ *sp = bsiz;
208
+ inflateEnd(&zs);
209
+ return buf;
210
+ }
211
+
212
+
213
+ static unsigned int _tc_getcrc_impl(const char *ptr, int size){
214
+ assert(ptr && size >= 0);
215
+ int crc = crc32(0, Z_NULL, 0);
216
+ return crc32(crc, (unsigned char *)ptr, size);
217
+ }
218
+
219
+
220
+ #else
221
+
222
+
223
+ char *(*_tc_deflate)(const char *, int, int *, int) = NULL;
224
+ char *(*_tc_inflate)(const char *, int, int *, int) = NULL;
225
+ unsigned int (*_tc_getcrc)(const char *, int) = NULL;
226
+
227
+
228
+ #endif
229
+
230
+
231
+
232
+ /*************************************************************************************************
233
+ * for BZIP2
234
+ *************************************************************************************************/
235
+
236
+
237
+ #if TCUSEBZIP
238
+
239
+
240
+ #include <bzlib.h>
241
+
242
+ #define BZIPBUFSIZ 8192
243
+
244
+
245
+ static char *_tc_bzcompress_impl(const char *ptr, int size, int *sp);
246
+ static char *_tc_bzdecompress_impl(const char *ptr, int size, int *sp);
247
+
248
+
249
+ char *(*_tc_bzcompress)(const char *, int, int *) = _tc_bzcompress_impl;
250
+ char *(*_tc_bzdecompress)(const char *, int, int *) = _tc_bzdecompress_impl;
251
+
252
+
253
+ static char *_tc_bzcompress_impl(const char *ptr, int size, int *sp){
254
+ assert(ptr && size >= 0 && sp);
255
+ bz_stream zs;
256
+ zs.bzalloc = NULL;
257
+ zs.bzfree = NULL;
258
+ zs.opaque = NULL;
259
+ if(BZ2_bzCompressInit(&zs, 9, 0, 0) != BZ_OK) return NULL;
260
+ int asiz = size + 16;
261
+ if(asiz < BZIPBUFSIZ) asiz = BZIPBUFSIZ;
262
+ char *buf;
263
+ if(!(buf = MYMALLOC(asiz))){
264
+ BZ2_bzCompressEnd(&zs);
265
+ return NULL;
266
+ }
267
+ char obuf[BZIPBUFSIZ];
268
+ int bsiz = 0;
269
+ zs.next_in = (char *)ptr;
270
+ zs.avail_in = size;
271
+ zs.next_out = obuf;
272
+ zs.avail_out = BZIPBUFSIZ;
273
+ int rv;
274
+ while((rv = BZ2_bzCompress(&zs, BZ_FINISH)) == BZ_FINISH_OK){
275
+ int osiz = BZIPBUFSIZ - zs.avail_out;
276
+ if(bsiz + osiz > asiz){
277
+ asiz = asiz * 2 + osiz;
278
+ char *swap;
279
+ if(!(swap = MYREALLOC(buf, asiz))){
280
+ MYFREE(buf);
281
+ BZ2_bzCompressEnd(&zs);
282
+ return NULL;
283
+ }
284
+ buf = swap;
285
+ }
286
+ memcpy(buf + bsiz, obuf, osiz);
287
+ bsiz += osiz;
288
+ zs.next_out = obuf;
289
+ zs.avail_out = BZIPBUFSIZ;
290
+ }
291
+ if(rv != BZ_STREAM_END){
292
+ MYFREE(buf);
293
+ BZ2_bzCompressEnd(&zs);
294
+ return NULL;
295
+ }
296
+ int osiz = BZIPBUFSIZ - zs.avail_out;
297
+ if(bsiz + osiz + 1 > asiz){
298
+ asiz = asiz * 2 + osiz;
299
+ char *swap;
300
+ if(!(swap = MYREALLOC(buf, asiz))){
301
+ MYFREE(buf);
302
+ BZ2_bzCompressEnd(&zs);
303
+ return NULL;
304
+ }
305
+ buf = swap;
306
+ }
307
+ memcpy(buf + bsiz, obuf, osiz);
308
+ bsiz += osiz;
309
+ buf[bsiz] = '\0';
310
+ *sp = bsiz;
311
+ BZ2_bzCompressEnd(&zs);
312
+ return buf;
313
+ }
314
+
315
+
316
+ static char *_tc_bzdecompress_impl(const char *ptr, int size, int *sp){
317
+ assert(ptr && size >= 0 && sp);
318
+ bz_stream zs;
319
+ zs.bzalloc = NULL;
320
+ zs.bzfree = NULL;
321
+ zs.opaque = NULL;
322
+ if(BZ2_bzDecompressInit(&zs, 0, 0) != BZ_OK) return NULL;
323
+ int asiz = size * 2 + 16;
324
+ if(asiz < BZIPBUFSIZ) asiz = BZIPBUFSIZ;
325
+ char *buf;
326
+ if(!(buf = MYMALLOC(asiz))){
327
+ BZ2_bzDecompressEnd(&zs);
328
+ return NULL;
329
+ }
330
+ char obuf[BZIPBUFSIZ];
331
+ int bsiz = 0;
332
+ zs.next_in = (char *)ptr;
333
+ zs.avail_in = size;
334
+ zs.next_out = obuf;
335
+ zs.avail_out = BZIPBUFSIZ;
336
+ int rv;
337
+ while((rv = BZ2_bzDecompress(&zs)) == BZ_OK){
338
+ int osiz = BZIPBUFSIZ - zs.avail_out;
339
+ if(bsiz + osiz >= asiz){
340
+ asiz = asiz * 2 + osiz;
341
+ char *swap;
342
+ if(!(swap = MYREALLOC(buf, asiz))){
343
+ MYFREE(buf);
344
+ BZ2_bzDecompressEnd(&zs);
345
+ return NULL;
346
+ }
347
+ buf = swap;
348
+ }
349
+ memcpy(buf + bsiz, obuf, osiz);
350
+ bsiz += osiz;
351
+ zs.next_out = obuf;
352
+ zs.avail_out = BZIPBUFSIZ;
353
+ }
354
+ if(rv != BZ_STREAM_END){
355
+ MYFREE(buf);
356
+ BZ2_bzDecompressEnd(&zs);
357
+ return NULL;
358
+ }
359
+ int osiz = BZIPBUFSIZ - zs.avail_out;
360
+ if(bsiz + osiz >= asiz){
361
+ asiz = asiz * 2 + osiz;
362
+ char *swap;
363
+ if(!(swap = MYREALLOC(buf, asiz))){
364
+ MYFREE(buf);
365
+ BZ2_bzDecompressEnd(&zs);
366
+ return NULL;
367
+ }
368
+ buf = swap;
369
+ }
370
+ memcpy(buf + bsiz, obuf, osiz);
371
+ bsiz += osiz;
372
+ buf[bsiz] = '\0';
373
+ *sp = bsiz;
374
+ BZ2_bzDecompressEnd(&zs);
375
+ return buf;
376
+ }
377
+
378
+
379
+ #else
380
+
381
+
382
+ char *(*_tc_bzcompress)(const char *, int, int *) = NULL;
383
+ char *(*_tc_bzdecompress)(const char *, int, int *) = NULL;
384
+
385
+
386
+ #endif
387
+
388
+
389
+
390
+ /*************************************************************************************************
391
+ * for test of custom codec functions
392
+ *************************************************************************************************/
393
+
394
+
395
+ #if TCUSEEXLZMA
396
+
397
+
398
+ #include <lzmalib.h>
399
+
400
+
401
+ void *_tc_recencode(const void *ptr, int size, int *sp, void *op){
402
+ return lzma_compress(ptr, size, sp);
403
+ }
404
+
405
+
406
+ void *_tc_recdecode(const void *ptr, int size, int *sp, void *op){
407
+ return lzma_decompress(ptr, size, sp);
408
+ }
409
+
410
+
411
+ #elif TCUSEEXLZO
412
+
413
+
414
+ #include <lzo/lzo1x.h>
415
+
416
+
417
+ bool _tc_lzo_init = false;
418
+
419
+
420
+ void *_tc_recencode(const void *ptr, int size, int *sp, void *op){
421
+ if(!_tc_lzo_init){
422
+ if(lzo_init() != LZO_E_OK) return NULL;
423
+ _tc_lzo_init = false;
424
+ }
425
+ lzo_bytep buf = MYMALLOC(size + (size >> 4) + 80);
426
+ if(!buf) return NULL;
427
+ lzo_uint bsiz;
428
+ char wrkmem[LZO1X_1_MEM_COMPRESS];
429
+ if(lzo1x_1_compress((lzo_bytep)ptr, size, buf, &bsiz, wrkmem) != LZO_E_OK){
430
+ MYFREE(buf);
431
+ return NULL;
432
+ }
433
+ buf[bsiz] = '\0';
434
+ *sp = bsiz;
435
+ return (char *)buf;
436
+ }
437
+
438
+
439
+ void *_tc_recdecode(const void *ptr, int size, int *sp, void *op){
440
+ if(!_tc_lzo_init){
441
+ if(lzo_init() != LZO_E_OK) return NULL;
442
+ _tc_lzo_init = false;
443
+ }
444
+ lzo_bytep buf;
445
+ lzo_uint bsiz;
446
+ int rat = 6;
447
+ while(true){
448
+ bsiz = (size + 256) * rat + 3;
449
+ buf = MYMALLOC(bsiz + 1);
450
+ if(!buf) return NULL;
451
+ int rv = lzo1x_decompress_safe((lzo_bytep)ptr, size, buf, &bsiz, NULL);
452
+ if(rv == LZO_E_OK){
453
+ break;
454
+ } else if(rv == LZO_E_OUTPUT_OVERRUN){
455
+ MYFREE(buf);
456
+ rat *= 2;
457
+ } else {
458
+ MYFREE(buf);
459
+ return NULL;
460
+ }
461
+ }
462
+ buf[bsiz] = '\0';
463
+ if(sp) *sp = bsiz;
464
+ return (char *)buf;
465
+ }
466
+
467
+
468
+ #else
469
+
470
+
471
+ void *_tc_recencode(const void *ptr, int size, int *sp, void *op){
472
+ char *res = MYMALLOC(size + 1);
473
+ if(!res) return NULL;
474
+ memcpy(res, ptr, size);
475
+ *sp = size;
476
+ return res;
477
+ }
478
+
479
+
480
+ void *_tc_recdecode(const void *ptr, int size, int *sp, void *op){
481
+ char *res = MYMALLOC(size + 1);
482
+ if(!res) return NULL;
483
+ memcpy(res, ptr, size);
484
+ *sp = size;
485
+ return res;
486
+ }
487
+
488
+
489
+ #endif
490
+
491
+
492
+
493
+ // END OF FILE