licenses.list.txt 42 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214
  1. ====================COPYRIGHT====================
  2. Copyright (C) 1998, 2001, 2003-2006, 2009-2020 Free Software Foundation,
  3. Inc.
  4. ====================COPYRIGHT====================
  5. Copyright (C) 1987-2020 Free Software Foundation, Inc.
  6. This file is part of the GNU C Library and is also part of gnulib.
  7. Patches to this file should be submitted to both projects.
  8. ====================COPYRIGHT====================
  9. Copyright (C) 1988-1989, 1992-1993, 1995, 2001-2003, 2006, 2008-2020 Free
  10. Software Foundation, Inc.
  11. ====================COPYRIGHT====================
  12. Copyright (C) 1988-1989, 1992-1995, 2001-2004, 2006-2020 Free Software
  13. Foundation, Inc.
  14. ====================COPYRIGHT====================
  15. Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2007, 2009-2013 Free Software
  16. Foundation, Inc.
  17. This file is part of the GNU C Library.
  18. ====================COPYRIGHT====================
  19. Copyright (C) 1989-2020 Free Software Foundation, Inc.
  20. This file is part of the GNU C Library and is also part of gnulib.
  21. Patches to this file should be submitted to both projects.
  22. ====================COPYRIGHT====================
  23. Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2020 Free Software
  24. Foundation, Inc.
  25. ====================COPYRIGHT====================
  26. Copyright (C) 1990, 1998-1999, 2001-2002, 2004-2005, 2009-2020 Free Software
  27. Foundation, Inc.
  28. ====================COPYRIGHT====================
  29. Copyright (C) 1990, 1998-1999, 2001-2007, 2009-2020 Free Software
  30. Foundation, Inc.
  31. ====================COPYRIGHT====================
  32. Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2020 Free Software
  33. Foundation, Inc.
  34. ====================COPYRIGHT====================
  35. Copyright (C) 1990, 2001, 2003-2006, 2009-2020 Free Software Foundation,
  36. Inc.
  37. ====================COPYRIGHT====================
  38. Copyright (C) 1990-1998, 2000-2007, 2009-2020 Free Software Foundation, Inc.
  39. This file is part of the GNU C Library.
  40. ====================COPYRIGHT====================
  41. Copyright (C) 1990-2000, 2002-2006, 2008-2020 Free Software Foundation, Inc.
  42. ====================COPYRIGHT====================
  43. Copyright (C) 1990-2000, 2003-2004, 2006-2020 Free Software Foundation, Inc.
  44. ====================COPYRIGHT====================
  45. Copyright (C) 1991, 2004-2006, 2009-2020 Free Software Foundation, Inc.
  46. ====================COPYRIGHT====================
  47. Copyright (C) 1992, 1995, 1997-1998, 2006, 2009-2020 Free Software
  48. Foundation, Inc.
  49. ====================COPYRIGHT====================
  50. Copyright (C) 1995, 1998, 2001, 2003, 2005, 2009-2020 Free Software
  51. Foundation, Inc.
  52. ====================COPYRIGHT====================
  53. Copyright (C) 1995, 1999, 2001-2004, 2006-2013 Free Software Foundation,
  54. Inc.
  55. ====================COPYRIGHT====================
  56. Copyright (C) 1995, 2000, 2002-2003, 2006, 2008-2020 Free Software
  57. Foundation, Inc.
  58. ====================COPYRIGHT====================
  59. Copyright (C) 1995-1996, 2001, 2003, 2005, 2009-2020 Free Software
  60. Foundation, Inc.
  61. ====================COPYRIGHT====================
  62. Copyright (C) 1995-1997, 2003, 2006, 2008-2020 Free Software Foundation,
  63. Inc.
  64. This file is part of the GNU C Library.
  65. ====================COPYRIGHT====================
  66. Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2020 Free Software
  67. Foundation, Inc.
  68. ====================COPYRIGHT====================
  69. Copyright (C) 1996-1998, 2001-2003, 2005-2007, 2009-2020 Free Software
  70. Foundation, Inc.
  71. ====================COPYRIGHT====================
  72. Copyright (C) 1997-1999, 2002-2004, 2006-2007, 2009-2020 Free Software
  73. Foundation, Inc.
  74. ====================COPYRIGHT====================
  75. Copyright (C) 1997-2000, 2002-2004, 2006, 2009-2020 Free Software
  76. Foundation, Inc.
  77. ====================COPYRIGHT====================
  78. Copyright (C) 1997-2020 Free Software Foundation, Inc.
  79. This file is part of the GNU C Library.
  80. Contributed by Jean-François Bignolles <bignolle@ecoledoc.ibp.fr>, 1997.
  81. ====================COPYRIGHT====================
  82. Copyright (C) 1998, 2000, 2003-2004, 2006, 2008-2020 Free Software
  83. Foundation, Inc.
  84. ====================COPYRIGHT====================
  85. Copyright (C) 1998-1999, 2001, 2003, 2009-2020 Free Software Foundation,
  86. Inc.
  87. Written by Jim Meyering <meyering@ascend.com>, 1998.
  88. ====================COPYRIGHT====================
  89. Copyright (C) 1998-1999, 2005-2006, 2009-2020 Free Software Foundation, Inc.
  90. ====================COPYRIGHT====================
  91. Copyright (C) 1998-2001, 2003, 2009-2020 Free Software Foundation, Inc.
  92. ====================COPYRIGHT====================
  93. Copyright (C) 1998-2002, 2004, 2006, 2008-2020 Free Software Foundation,
  94. Inc.
  95. ====================COPYRIGHT====================
  96. Copyright (C) 1998-2002, 2004, 2006-2020 Free Software Foundation, Inc.
  97. ====================COPYRIGHT====================
  98. Copyright (C) 1998-2002, 2004-2020 Free Software Foundation, Inc.
  99. ====================COPYRIGHT====================
  100. Copyright (C) 1998-2004, 2006-2007, 2009-2020 Free Software Foundation, Inc.
  101. ====================COPYRIGHT====================
  102. Copyright (C) 1999, 2002, 2006, 2009-2020 Free Software Foundation, Inc.
  103. ====================COPYRIGHT====================
  104. Copyright (C) 1999, 2002, 2006-2007, 2009-2020 Free Software Foundation,
  105. Inc.
  106. ====================COPYRIGHT====================
  107. Copyright (C) 1999, 2002, 2006-2020 Free Software Foundation, Inc.
  108. ====================COPYRIGHT====================
  109. Copyright (C) 1999, 2002-2003, 2005, 2007, 2010-2020 Free Software
  110. Foundation, Inc.
  111. ====================COPYRIGHT====================
  112. Copyright (C) 1999, 2002-2003, 2005-2007, 2009-2020 Free Software
  113. Foundation, Inc.
  114. ====================COPYRIGHT====================
  115. Copyright (C) 1999, 2002-2003, 2006-2007, 2011-2020 Free Software
  116. Foundation, Inc.
  117. ====================COPYRIGHT====================
  118. Copyright (C) 1999, 2002-2020 Free Software Foundation, Inc.
  119. ====================COPYRIGHT====================
  120. Copyright (C) 1999, 2003-2004, 2009-2020 Free Software Foundation, Inc.
  121. ====================COPYRIGHT====================
  122. Copyright (C) 1999, 2004-2007, 2009-2020 Free Software Foundation, Inc.
  123. ====================COPYRIGHT====================
  124. Copyright (C) 1999-2000, 2002-2003, 2006-2020 Free Software Foundation, Inc.
  125. ====================COPYRIGHT====================
  126. Copyright (C) 1999-2002, 2005-2020 Free Software Foundation, Inc.
  127. Written by Bruno Haible <bruno@clisp.org>, 2008.
  128. ====================COPYRIGHT====================
  129. Copyright (C) 1999-2002, 2006-2007, 2009-2020 Free Software Foundation, Inc.
  130. Written by Bruno Haible <bruno@clisp.org>, 2001.
  131. ====================COPYRIGHT====================
  132. Copyright (C) 2000, 2002, 2004, 2006, 2009-2015, 2018-2020 Free Software
  133. Foundation, Inc.
  134. ====================COPYRIGHT====================
  135. Copyright (C) 2000, 2002, 2004, 2009-2015, 2018-2020 Free Software
  136. Foundation, Inc.
  137. ====================COPYRIGHT====================
  138. Copyright (C) 2000, 2002, 2004-2005, 2007, 2009-2020 Free Software
  139. Foundation, Inc.
  140. ====================COPYRIGHT====================
  141. Copyright (C) 2000, 2003, 2005-2006, 2009-2020 Free Software Foundation,
  142. Inc.
  143. ====================COPYRIGHT====================
  144. Copyright (C) 2000, 2003-2004, 2008-2013 Free Software Foundation, Inc.
  145. This file is part of the GNU C Library.
  146. ====================COPYRIGHT====================
  147. Copyright (C) 2000, 2004, 2006-2007, 2009-2020 Free Software Foundation,
  148. Inc.
  149. ====================COPYRIGHT====================
  150. Copyright (C) 2000-2003, 2005, 2008-2020 Free Software Foundation, Inc.
  151. ====================COPYRIGHT====================
  152. Copyright (C) 2000-2003, 2006, 2008-2020 Free Software Foundation, Inc.
  153. ====================COPYRIGHT====================
  154. Copyright (C) 2000-2003, 2009-2020 Free Software Foundation, Inc.
  155. This file is part of the GNU CHARSET Library.
  156. ====================COPYRIGHT====================
  157. Copyright (C) 2000-2004, 2007, 2009-2020 Free Software Foundation, Inc.
  158. ====================COPYRIGHT====================
  159. Copyright (C) 2000-2006, 2008-2020 Free Software Foundation, Inc.
  160. ====================COPYRIGHT====================
  161. Copyright (C) 2000-2020 Free Software Foundation, Inc.
  162. ====================COPYRIGHT====================
  163. Copyright (C) 2001, 2003, 2005, 2008-2020 Free Software Foundation, Inc.
  164. ====================COPYRIGHT====================
  165. Copyright (C) 2001, 2003, 2005, 2009-2020 Free Software Foundation, Inc.
  166. ====================COPYRIGHT====================
  167. Copyright (C) 2001, 2003, 2006, 2009-2020 Free Software Foundation, Inc.
  168. ====================COPYRIGHT====================
  169. Copyright (C) 2001, 2003-2004, 2007, 2009-2020 Free Software Foundation,
  170. Inc.
  171. ====================COPYRIGHT====================
  172. Copyright (C) 2001, 2003-2007, 2009-2020 Free Software Foundation, Inc.
  173. ====================COPYRIGHT====================
  174. Copyright (C) 2001, 2003-2020 Free Software Foundation, Inc.
  175. Written by Bruno Haible <bruno@clisp.org>, 2003.
  176. ====================COPYRIGHT====================
  177. Copyright (C) 2001, 2004-2006, 2009-2020 Free Software Foundation, Inc.
  178. ====================COPYRIGHT====================
  179. Copyright (C) 2001, 2005, 2009-2020 Free Software Foundation, Inc.
  180. ====================COPYRIGHT====================
  181. Copyright (C) 2001, 2005-2007, 2009-2020 Free Software Foundation, Inc.
  182. ====================COPYRIGHT====================
  183. Copyright (C) 2001-2002, 2004-2006, 2009-2015, 2018-2020 Free Software
  184. Foundation, Inc.
  185. ====================COPYRIGHT====================
  186. Copyright (C) 2001-2002, 2005, 2007, 2009-2020 Free Software Foundation,
  187. Inc.
  188. ====================COPYRIGHT====================
  189. Copyright (C) 2001-2002, 2005-2007, 2009-2020 Free Software Foundation, Inc.
  190. Written by Bruno Haible <bruno@clisp.org>, 2002.
  191. ====================COPYRIGHT====================
  192. Copyright (C) 2001-2002, 2005-2020 Free Software Foundation, Inc.
  193. ====================COPYRIGHT====================
  194. Copyright (C) 2001-2002, 2006-2020 Free Software Foundation, Inc.
  195. Written by Bruno Haible <bruno@clisp.org>, 2002.
  196. ====================COPYRIGHT====================
  197. Copyright (C) 2001-2002, 2007, 2009-2020 Free Software Foundation, Inc.
  198. ====================COPYRIGHT====================
  199. Copyright (C) 2001-2003, 2005-2013 Free Software Foundation, Inc.
  200. ====================COPYRIGHT====================
  201. Copyright (C) 2001-2003, 2005-2020 Free Software Foundation, Inc.
  202. Written by Bruno Haible <bruno@clisp.org>, 2001.
  203. ====================COPYRIGHT====================
  204. Copyright (C) 2001-2003, 2006, 2008-2020 Free Software Foundation, Inc.
  205. Written by Bruno Haible <haible@clisp.cons.org>, 2001.
  206. ====================COPYRIGHT====================
  207. Copyright (C) 2001-2004, 2006, 2009-2020 Free Software Foundation, Inc.
  208. Written by Bruno Haible <bruno@clisp.org>, 2001.
  209. ====================COPYRIGHT====================
  210. Copyright (C) 2001-2004, 2006-2020 Free Software Foundation, Inc.
  211. ====================COPYRIGHT====================
  212. Copyright (C) 2001-2004, 2007-2020 Free Software Foundation, Inc.
  213. ====================COPYRIGHT====================
  214. Copyright (C) 2001-2004, 2009-2020 Free Software Foundation, Inc.
  215. ====================COPYRIGHT====================
  216. Copyright (C) 2001-2020 Free Software Foundation, Inc.
  217. ====================COPYRIGHT====================
  218. Copyright (C) 2002, 2004, 2009-2015, 2018-2020 Free Software Foundation,
  219. Inc.
  220. ====================COPYRIGHT====================
  221. Copyright (C) 2002, 2005-2006, 2009-2020 Free Software Foundation, Inc.
  222. ====================COPYRIGHT====================
  223. Copyright (C) 2002, 2006, 2009-2015, 2018-2021 Free Software
  224. Foundation, Inc.
  225. ====================COPYRIGHT====================
  226. Copyright (C) 2002, 2006-2007, 2009-2020 Free Software Foundation, Inc.
  227. Written by Bruno Haible <bruno@clisp.org>, 2002.
  228. ====================COPYRIGHT====================
  229. Copyright (C) 2002, 2007, 2009-2015, 2018-2021 Free Software
  230. Foundation, Inc.
  231. ====================COPYRIGHT====================
  232. Copyright (C) 2002, 2009-2015, 2018-2021 Free Software Foundation,
  233. Inc.
  234. ====================COPYRIGHT====================
  235. Copyright (C) 2002, 2009-2020 Free Software Foundation, Inc.
  236. ====================COPYRIGHT====================
  237. Copyright (C) 2002-2003, 2005-2006, 2009-2020 Free Software Foundation, Inc.
  238. ====================COPYRIGHT====================
  239. Copyright (C) 2002-2003, 2005-2007, 2009-2020 Free Software Foundation, Inc.
  240. ====================COPYRIGHT====================
  241. Copyright (C) 2002-2003, 2006, 2009-2015, 2018-2020 Free Software
  242. Foundation, Inc.
  243. ====================COPYRIGHT====================
  244. Copyright (C) 2002-2004, 2006, 2009-2015, 2018-2020 Free Software
  245. Foundation, Inc.
  246. ====================COPYRIGHT====================
  247. Copyright (C) 2002-2004, 2007-2020 Free Software Foundation, Inc.
  248. ====================COPYRIGHT====================
  249. Copyright (C) 2002-2004, 2009-2015, 2018-2020 Free Software Foundation, Inc.
  250. ====================COPYRIGHT====================
  251. Copyright (C) 2002-2006, 2009-2015, 2018-2020 Free Software Foundation, Inc.
  252. ====================COPYRIGHT====================
  253. Copyright (C) 2003, 2005, 2008-2020 Free Software Foundation, Inc.
  254. Written by Bruno Haible <bruno@clisp.org>, 2003.
  255. ====================COPYRIGHT====================
  256. Copyright (C) 2003, 2006-2007, 2009-2020 Free Software Foundation, Inc.
  257. ====================COPYRIGHT====================
  258. Copyright (C) 2003, 2008-2020 Free Software Foundation, Inc.
  259. ====================COPYRIGHT====================
  260. Copyright (C) 2003, 2009-2020 Free Software Foundation, Inc.
  261. ====================COPYRIGHT====================
  262. Copyright (C) 2003-2004, 2006-2020 Free Software Foundation, Inc.
  263. Written by Bruno Haible <bruno@clisp.org>, 2003.
  264. ====================COPYRIGHT====================
  265. Copyright (C) 2003-2004, 2009-2020 Free Software Foundation, Inc.
  266. Written by Bruno Haible <bruno@clisp.org>, 2003.
  267. ====================COPYRIGHT====================
  268. Copyright (C) 2003-2013 Free Software Foundation, Inc.
  269. ====================COPYRIGHT====================
  270. Copyright (C) 2004, 2009-2020 Free Software Foundation, Inc.
  271. ====================COPYRIGHT====================
  272. Copyright (C) 2005, 2007-2020 Free Software Foundation, Inc.
  273. ====================COPYRIGHT====================
  274. Copyright (C) 2005, 2009-2020 Free Software Foundation, Inc.
  275. ====================COPYRIGHT====================
  276. Copyright (C) 2005-2006, 2009-2020 Free Software Foundation, Inc.
  277. ====================COPYRIGHT====================
  278. Copyright (C) 2005-2007, 2009-2020 Free Software Foundation, Inc.
  279. ====================COPYRIGHT====================
  280. Copyright (C) 2005-2013 Free Software Foundation, Inc.
  281. ====================COPYRIGHT====================
  282. Copyright (C) 2005-2020 Free Software Foundation, Inc.
  283. ====================COPYRIGHT====================
  284. Copyright (C) 2006, 2009-2020 Free Software Foundation, Inc.
  285. Written by Bruno Haible <bruno@clisp.org>, 2006.
  286. ====================COPYRIGHT====================
  287. Copyright (C) 2006-2007, 2010-2020 Free Software Foundation, Inc.
  288. ====================COPYRIGHT====================
  289. Copyright (C) 2006-2007, 2019-2020 Free Software Foundation, Inc.
  290. ====================COPYRIGHT====================
  291. Copyright (C) 2006-2013 Free Software Foundation, Inc.
  292. ====================COPYRIGHT====================
  293. Copyright (C) 2007, 2009-2020 Free Software Foundation, Inc.
  294. Written by Bruno Haible <bruno@clisp.org>, 2007.
  295. ====================COPYRIGHT====================
  296. Copyright (C) 2007-2008, 2010-2020 Free Software Foundation, Inc.
  297. ====================COPYRIGHT====================
  298. Copyright (C) 2007-2020 Free Software Foundation, Inc.
  299. Written by Bruno Haible <bruno@clisp.org>, 2007.
  300. ====================COPYRIGHT====================
  301. Copyright (C) 2008-2013 Free Software Foundation, Inc.
  302. ====================COPYRIGHT====================
  303. Copyright (C) 2008-2020 Free Software Foundation, Inc.
  304. ====================COPYRIGHT====================
  305. Copyright (C) 2009-2020 Free Software Foundation, Inc.
  306. ====================COPYRIGHT====================
  307. Copyright (C) 2011-2020 Free Software Foundation, Inc.
  308. ====================COPYRIGHT====================
  309. Copyright (C) 2014-2020 Free Software Foundation, Inc.
  310. ====================COPYRIGHT====================
  311. Copyright (C) 2016-2020 Free Software Foundation, Inc.
  312. ====================COPYRIGHT====================
  313. Copyright (C) 2018-2021 Free Software Foundation, Inc.
  314. ====================COPYRIGHT====================
  315. Copyright (C) 2019-2020 Free Software Foundation, Inc.
  316. ====================COPYRIGHT====================
  317. Copyright (C) 2020 Free Software Foundation, Inc.
  318. ====================COPYRIGHT====================
  319. Copyright 2017-2020 Free Software Foundation, Inc.
  320. ====================COPYRIGHT====================
  321. Copyright 2020 Free Software Foundation, Inc.
  322. ====================COPYRIGHT====================
  323. # define ISSLASH(C) ((C) == '/' || (C) == '\\')
  324. /* Internal macro: Tests whether a character is a drive letter. */
  325. # define _IS_DRIVE_LETTER(C) \
  326. (((C) >= 'A' && (C) <= 'Z') || ((C) >= 'a' && (C) <= 'z'))
  327. /* Help the compiler optimizing it. This assumes ASCII. */
  328. # undef _IS_DRIVE_LETTER
  329. # define _IS_DRIVE_LETTER(C) \
  330. (((unsigned int) (C) | ('a' - 'A')) - 'a' <= 'z' - 'a')
  331. # define HAS_DEVICE(Filename) \
  332. (_IS_DRIVE_LETTER ((Filename)[0]) && (Filename)[1] == ':')
  333. ====================COPYRIGHT====================
  334. /* Copyright (C) 1993, 1995-1997, 2002-2003, 2005-2007, 2009-2020 Free Software
  335. * Foundation, Inc.
  336. ====================COPYRIGHT====================
  337. /* Copyright (C) 2001, 2006, 2009-2020 Free Software Foundation, Inc.
  338. ====================COPYRIGHT====================
  339. /* Sequential list data type implemented by a binary tree.
  340. Copyright (C) 2006-2007, 2009-2020 Free Software Foundation, Inc.
  341. Written by Bruno Haible <bruno@clisp.org>, 2006.
  342. ====================COPYRIGHT====================
  343. /* Sequential list data type implemented by a linked list.
  344. Copyright (C) 2006, 2008-2020 Free Software Foundation, Inc.
  345. Written by Bruno Haible <bruno@clisp.org>, 2006.
  346. ====================COPYRIGHT====================
  347. /* Sequential list data type implemented by a linked list.
  348. Copyright (C) 2006-2020 Free Software Foundation, Inc.
  349. Written by Bruno Haible <bruno@clisp.org>, 2006.
  350. ====================COPYRIGHT====================
  351. /* obstack.c - subroutines used implicitly by object stack macros
  352. Copyright (C) 1988-2020 Free Software Foundation, Inc.
  353. This file is part of the GNU C Library.
  354. ====================File: lib/obstack.c====================
  355. /* obstack.c - subroutines used implicitly by object stack macros
  356. Copyright (C) 1988-2020 Free Software Foundation, Inc.
  357. This file is part of the GNU C Library.
  358. The GNU C Library is free software; you can redistribute it and/or
  359. modify it under the terms of the GNU General Public
  360. License as published by the Free Software Foundation; either
  361. version 3 of the License, or (at your option) any later version.
  362. The GNU C Library is distributed in the hope that it will be useful,
  363. but WITHOUT ANY WARRANTY; without even the implied warranty of
  364. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  365. General Public License for more details.
  366. You should have received a copy of the GNU General Public
  367. License along with the GNU C Library; if not, see
  368. <https://www.gnu.org/licenses/>. */
  369. #ifdef _LIBC
  370. # include <obstack.h>
  371. #else
  372. # include <config.h>
  373. # include "obstack.h"
  374. #endif
  375. /* NOTE BEFORE MODIFYING THIS FILE: _OBSTACK_INTERFACE_VERSION in
  376. obstack.h must be incremented whenever callers compiled using an old
  377. obstack.h can no longer properly call the functions in this file. */
  378. /* Comment out all this code if we are using the GNU C Library, and are not
  379. actually compiling the library itself, and the installed library
  380. supports the same library interface we do. This code is part of the GNU
  381. C Library, but also included in many other GNU distributions. Compiling
  382. and linking in this code is a waste when using the GNU C library
  383. (especially if it is a shared library). Rather than having every GNU
  384. program understand 'configure --with-gnu-libc' and omit the object
  385. files, it is simpler to just do this in the source for each such file. */
  386. #if !defined _LIBC && defined __GNU_LIBRARY__ && __GNU_LIBRARY__ > 1
  387. # include <gnu-versions.h>
  388. # if (_GNU_OBSTACK_INTERFACE_VERSION == _OBSTACK_INTERFACE_VERSION \
  389. || (_GNU_OBSTACK_INTERFACE_VERSION == 1 \
  390. && _OBSTACK_INTERFACE_VERSION == 2 \
  391. && defined SIZEOF_INT && defined SIZEOF_SIZE_T \
  392. && SIZEOF_INT == SIZEOF_SIZE_T))
  393. # define _OBSTACK_ELIDE_CODE
  394. # endif
  395. #endif
  396. #ifndef _OBSTACK_ELIDE_CODE
  397. /* If GCC, or if an oddball (testing?) host that #defines __alignof__,
  398. use the already-supplied __alignof__. Otherwise, this must be Gnulib
  399. (as glibc assumes GCC); defer to Gnulib's alignof_type. */
  400. # include <stdlib.h>
  401. # include <stdint.h>
  402. # ifndef MAX
  403. # define MAX(a,b) ((a) > (b) ? (a) : (b))
  404. # endif
  405. /* Determine default alignment. */
  406. /* If malloc were really smart, it would round addresses to DEFAULT_ALIGNMENT.
  407. But in fact it might be less smart and round addresses to as much as
  408. DEFAULT_ROUNDING. So we prepare for it to do that.
  409. DEFAULT_ALIGNMENT cannot be an enum constant; see gnulib's alignof.h. */
  410. #define DEFAULT_ALIGNMENT MAX (__alignof__ (long double), \
  411. MAX (__alignof__ (uintmax_t), \
  412. __alignof__ (void *)))
  413. #define DEFAULT_ROUNDING MAX (sizeof (long double), \
  414. MAX (sizeof (uintmax_t), \
  415. sizeof (void *)))
  416. /* Call functions with either the traditional malloc/free calling
  417. interface, or the mmalloc/mfree interface (that adds an extra first
  418. argument), based on the value of use_extra_arg. */
  419. static void *
  420. call_chunkfun (struct obstack *h, size_t size)
  421. {
  422. if (h->use_extra_arg)
  423. return h->chunkfun.extra (h->extra_arg, size);
  424. else
  425. return h->chunkfun.plain (size);
  426. }
  427. static void
  428. call_freefun (struct obstack *h, void *old_chunk)
  429. {
  430. if (h->use_extra_arg)
  431. h->freefun.extra (h->extra_arg, old_chunk);
  432. else
  433. h->freefun.plain (old_chunk);
  434. }
  435. /* Initialize an obstack H for use. Specify chunk size SIZE (0 means default).
  436. Objects start on multiples of ALIGNMENT (0 means use default).
  437. Return nonzero if successful, calls obstack_alloc_failed_handler if
  438. allocation fails. */
  439. static int
  440. _obstack_begin_worker (struct obstack *h,
  441. _OBSTACK_SIZE_T size, _OBSTACK_SIZE_T alignment)
  442. {
  443. struct _obstack_chunk *chunk; /* points to new chunk */
  444. if (alignment == 0)
  445. alignment = DEFAULT_ALIGNMENT;
  446. if (size == 0)
  447. /* Default size is what GNU malloc can fit in a 4096-byte block. */
  448. {
  449. /* 12 is sizeof (mhead) and 4 is EXTRA from GNU malloc.
  450. Use the values for range checking, because if range checking is off,
  451. the extra bytes won't be missed terribly, but if range checking is on
  452. and we used a larger request, a whole extra 4096 bytes would be
  453. allocated.
  454. These number are irrelevant to the new GNU malloc. I suspect it is
  455. less sensitive to the size of the request. */
  456. int extra = ((((12 + DEFAULT_ROUNDING - 1) & ~(DEFAULT_ROUNDING - 1))
  457. + 4 + DEFAULT_ROUNDING - 1)
  458. & ~(DEFAULT_ROUNDING - 1));
  459. size = 4096 - extra;
  460. }
  461. h->chunk_size = size;
  462. h->alignment_mask = alignment - 1;
  463. chunk = h->chunk = call_chunkfun (h, h->chunk_size);
  464. if (!chunk)
  465. (*obstack_alloc_failed_handler) ();
  466. h->next_free = h->object_base = __PTR_ALIGN ((char *) chunk, chunk->contents,
  467. alignment - 1);
  468. h->chunk_limit = chunk->limit = (char *) chunk + h->chunk_size;
  469. chunk->prev = 0;
  470. /* The initial chunk now contains no empty object. */
  471. h->maybe_empty_object = 0;
  472. h->alloc_failed = 0;
  473. return 1;
  474. }
  475. int
  476. _obstack_begin (struct obstack *h,
  477. _OBSTACK_SIZE_T size, _OBSTACK_SIZE_T alignment,
  478. void *(*chunkfun) (size_t),
  479. void (*freefun) (void *))
  480. {
  481. h->chunkfun.plain = chunkfun;
  482. h->freefun.plain = freefun;
  483. h->use_extra_arg = 0;
  484. return _obstack_begin_worker (h, size, alignment);
  485. }
  486. int
  487. _obstack_begin_1 (struct obstack *h,
  488. _OBSTACK_SIZE_T size, _OBSTACK_SIZE_T alignment,
  489. void *(*chunkfun) (void *, size_t),
  490. void (*freefun) (void *, void *),
  491. void *arg)
  492. {
  493. h->chunkfun.extra = chunkfun;
  494. h->freefun.extra = freefun;
  495. h->extra_arg = arg;
  496. h->use_extra_arg = 1;
  497. return _obstack_begin_worker (h, size, alignment);
  498. }
  499. /* Allocate a new current chunk for the obstack *H
  500. on the assumption that LENGTH bytes need to be added
  501. to the current object, or a new object of length LENGTH allocated.
  502. Copies any partial object from the end of the old chunk
  503. to the beginning of the new one. */
  504. void
  505. _obstack_newchunk (struct obstack *h, _OBSTACK_SIZE_T length)
  506. {
  507. struct _obstack_chunk *old_chunk = h->chunk;
  508. struct _obstack_chunk *new_chunk = 0;
  509. size_t obj_size = h->next_free - h->object_base;
  510. char *object_base;
  511. /* Compute size for new chunk. */
  512. size_t sum1 = obj_size + length;
  513. size_t sum2 = sum1 + h->alignment_mask;
  514. size_t new_size = sum2 + (obj_size >> 3) + 100;
  515. if (new_size < sum2)
  516. new_size = sum2;
  517. if (new_size < h->chunk_size)
  518. new_size = h->chunk_size;
  519. /* Allocate and initialize the new chunk. */
  520. if (obj_size <= sum1 && sum1 <= sum2)
  521. new_chunk = call_chunkfun (h, new_size);
  522. if (!new_chunk)
  523. (*obstack_alloc_failed_handler)();
  524. h->chunk = new_chunk;
  525. new_chunk->prev = old_chunk;
  526. new_chunk->limit = h->chunk_limit = (char *) new_chunk + new_size;
  527. /* Compute an aligned object_base in the new chunk */
  528. object_base =
  529. __PTR_ALIGN ((char *) new_chunk, new_chunk->contents, h->alignment_mask);
  530. /* Move the existing object to the new chunk. */
  531. memcpy (object_base, h->object_base, obj_size);
  532. /* If the object just copied was the only data in OLD_CHUNK,
  533. free that chunk and remove it from the chain.
  534. But not if that chunk might contain an empty object. */
  535. if (!h->maybe_empty_object
  536. && (h->object_base
  537. == __PTR_ALIGN ((char *) old_chunk, old_chunk->contents,
  538. h->alignment_mask)))
  539. {
  540. new_chunk->prev = old_chunk->prev;
  541. call_freefun (h, old_chunk);
  542. }
  543. h->object_base = object_base;
  544. h->next_free = h->object_base + obj_size;
  545. /* The new chunk certainly contains no empty object yet. */
  546. h->maybe_empty_object = 0;
  547. }
  548. /* Return nonzero if object OBJ has been allocated from obstack H.
  549. This is here for debugging.
  550. If you use it in a program, you are probably losing. */
  551. /* Suppress -Wmissing-prototypes warning. We don't want to declare this in
  552. obstack.h because it is just for debugging. */
  553. int _obstack_allocated_p (struct obstack *h, void *obj) __attribute_pure__;
  554. int
  555. _obstack_allocated_p (struct obstack *h, void *obj)
  556. {
  557. struct _obstack_chunk *lp; /* below addr of any objects in this chunk */
  558. struct _obstack_chunk *plp; /* point to previous chunk if any */
  559. lp = (h)->chunk;
  560. /* We use >= rather than > since the object cannot be exactly at
  561. the beginning of the chunk but might be an empty object exactly
  562. at the end of an adjacent chunk. */
  563. while (lp != 0 && ((void *) lp >= obj || (void *) (lp)->limit < obj))
  564. {
  565. plp = lp->prev;
  566. lp = plp;
  567. }
  568. return lp != 0;
  569. }
  570. /* Free objects in obstack H, including OBJ and everything allocate
  571. more recently than OBJ. If OBJ is zero, free everything in H. */
  572. void
  573. _obstack_free (struct obstack *h, void *obj)
  574. {
  575. struct _obstack_chunk *lp; /* below addr of any objects in this chunk */
  576. struct _obstack_chunk *plp; /* point to previous chunk if any */
  577. lp = h->chunk;
  578. /* We use >= because there cannot be an object at the beginning of a chunk.
  579. But there can be an empty object at that address
  580. at the end of another chunk. */
  581. while (lp != 0 && ((void *) lp >= obj || (void *) (lp)->limit < obj))
  582. {
  583. plp = lp->prev;
  584. call_freefun (h, lp);
  585. lp = plp;
  586. /* If we switch chunks, we can't tell whether the new current
  587. chunk contains an empty object, so assume that it may. */
  588. h->maybe_empty_object = 1;
  589. }
  590. if (lp)
  591. {
  592. h->object_base = h->next_free = (char *) (obj);
  593. h->chunk_limit = lp->limit;
  594. h->chunk = lp;
  595. }
  596. else if (obj != 0)
  597. /* obj is not in any of the chunks! */
  598. abort ();
  599. }
  600. _OBSTACK_SIZE_T
  601. _obstack_memory_used (struct obstack *h)
  602. {
  603. struct _obstack_chunk *lp;
  604. _OBSTACK_SIZE_T nbytes = 0;
  605. for (lp = h->chunk; lp != 0; lp = lp->prev)
  606. {
  607. nbytes += lp->limit - (char *) lp;
  608. }
  609. return nbytes;
  610. }
  611. # ifndef _OBSTACK_NO_ERROR_HANDLER
  612. /* Define the error handler. */
  613. # include <stdio.h>
  614. /* Exit value used when 'print_and_abort' is used. */
  615. # ifdef _LIBC
  616. int obstack_exit_failure = EXIT_FAILURE;
  617. # else
  618. # include "exitfail.h"
  619. # define obstack_exit_failure exit_failure
  620. # endif
  621. # ifdef _LIBC
  622. # include <libintl.h>
  623. # else
  624. # include "gettext.h"
  625. # endif
  626. # ifndef _
  627. # define _(msgid) gettext (msgid)
  628. # endif
  629. # ifdef _LIBC
  630. # error #include <libio/iolibio.h>
  631. # endif
  632. static __attribute_noreturn__ void
  633. print_and_abort (void)
  634. {
  635. /* Don't change any of these strings. Yes, it would be possible to add
  636. the newline to the string and use fputs or so. But this must not
  637. happen because the "memory exhausted" message appears in other places
  638. like this and the translation should be reused instead of creating
  639. a very similar string which requires a separate translation. */
  640. # ifdef _LIBC
  641. (void) __fxprintf (NULL, "%s\n", _("memory exhausted"));
  642. # else
  643. fprintf (stderr, "%s\n", _("memory exhausted"));
  644. # endif
  645. exit (obstack_exit_failure);
  646. }
  647. /* The functions allocating more room by calling 'obstack_chunk_alloc'
  648. jump to the handler pointed to by 'obstack_alloc_failed_handler'.
  649. This can be set to a user defined function which should either
  650. abort gracefully or use longjump - but shouldn't return. This
  651. variable by default points to the internal function
  652. 'print_and_abort'. */
  653. __attribute_noreturn__ void (*obstack_alloc_failed_handler) (void)
  654. = print_and_abort;
  655. # endif /* !_OBSTACK_NO_ERROR_HANDLER */
  656. #endif /* !_OBSTACK_ELIDE_CODE */
  657. ====================GPL-3.0-or-later====================
  658. This program is free software: you can redistribute it and/or modify
  659. it under the terms of the GNU General Public License as published by
  660. the Free Software Foundation; either version 3 of the License, or
  661. (at your option) any later version.
  662. This program is distributed in the hope that it will be useful,
  663. but WITHOUT ANY WARRANTY; without even the implied warranty of
  664. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  665. GNU General Public License for more details.
  666. You should have received a copy of the GNU General Public License
  667. along with this program. If not, see <https://www.gnu.org/licenses/>. */
  668. ====================GPL-3.0-or-later====================
  669. The GNU C Library is free software; you can redistribute it and/or
  670. modify it under the terms of the GNU General Public
  671. License as published by the Free Software Foundation; either
  672. version 3 of the License, or (at your option) any later version.
  673. The GNU C Library is distributed in the hope that it will be useful,
  674. but WITHOUT ANY WARRANTY; without even the implied warranty of
  675. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  676. General Public License for more details.
  677. You should have received a copy of the GNU General Public
  678. License along with the GNU C Library; if not, see
  679. <https://www.gnu.org/licenses/>. */
  680. ====================GPL-3.0-or-later====================
  681. This program is free software: you can redistribute it and/or modify
  682. it under the terms of the GNU General Public License as published by
  683. the Free Software Foundation, either version 3 of the License, or
  684. (at your option) any later version.
  685. This program is distributed in the hope that it will be useful,
  686. but WITHOUT ANY WARRANTY; without even the implied warranty of
  687. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  688. GNU General Public License for more details.
  689. You should have received a copy of the GNU General Public License
  690. along with this program. If not, see <https://www.gnu.org/licenses/>. */
  691. ====================GPL-3.0-or-later====================
  692. This program is free software: you can redistribute it and/or modify
  693. it under the terms of the GNU General Public License as published by
  694. the Free Software Foundation; either version 3 of the License, or
  695. (at your option) any later version.
  696. This program is distributed in the hope that it will be useful,
  697. but WITHOUT ANY WARRANTY; without even the implied warranty of
  698. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  699. GNU General Public License for more details.
  700. You should have received a copy of the GNU General Public License
  701. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  702. ====================GPL-3.0-or-later====================
  703. This program is free software: you can redistribute it and/or modify
  704. it under the terms of the GNU General Public License as published by
  705. the Free Software Foundation; either version 3 of the License, or
  706. (at your option) any later version.
  707. This program is distributed in the hope that it will be useful,
  708. but WITHOUT ANY WARRANTY; without even the implied warranty of
  709. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  710. GNU General Public License for more details.
  711. You should have received a copy of the GNU General Public License
  712. along with this program. If not, see <https://www.gnu.org/licenses/>.
  713. ====================GPL-3.0-or-later====================
  714. This program is free software: you can redistribute it and/or modify
  715. it under the terms of the GNU General Public License as published by
  716. the Free Software Foundation; either version 3 of the License, or
  717. (at your option) any later version.
  718. This program is distributed in the hope that it will be useful,
  719. but WITHOUT ANY WARRANTY; without even the implied warranty of
  720. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  721. GNU General Public License for more details.
  722. You should have received a copy of the GNU General Public License
  723. along with this program. If not, see <https://www.gnu.org/licenses/>. */
  724. ====================GPL-3.0-or-later====================
  725. This program is free software: you can redistribute it and/or modify it
  726. under the terms of the GNU General Public License as published
  727. by the Free Software Foundation; either version 3 of the License, or
  728. (at your option) any later version.
  729. This program is distributed in the hope that it will be useful,
  730. but WITHOUT ANY WARRANTY; without even the implied warranty of
  731. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  732. GNU General Public License for more details.
  733. You should have received a copy of the GNU General Public License
  734. along with this program. If not, see <https://www.gnu.org/licenses/>. */
  735. ====================GPL-3.0-or-later====================
  736. This program is free software: you can redistribute it and/or modify it
  737. under the terms of the GNU General Public License as published
  738. by the Free Software Foundation; either version 3 of the License, or
  739. (at your option) any later version.
  740. This program is distributed in the hope that it will be useful,
  741. but WITHOUT ANY WARRANTY; without even the implied warranty of
  742. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  743. General Public License for more details.
  744. You should have received a copy of the GNU General Public License
  745. along with this program. If not, see <https://www.gnu.org/licenses/>. */
  746. ====================GPL-3.0-or-later====================
  747. This program is free software: you can redistribute it and/or modify it
  748. under the terms of the GNU General Public License as published by the
  749. Free Software Foundation; either version 3 of the License, or any
  750. later version.
  751. This program is distributed in the hope that it will be useful,
  752. but WITHOUT ANY WARRANTY; without even the implied warranty of
  753. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  754. GNU General Public License for more details.
  755. You should have received a copy of the GNU General Public License
  756. along with this program. If not, see <https://www.gnu.org/licenses/>. */
  757. ====================GPL-3.0-or-later====================
  758. This program is free software; you can redistribute it and/or modify
  759. it under the terms of the GNU General Public License as published by
  760. the Free Software Foundation; either version 3, or (at your option)
  761. any later version.
  762. This program is distributed in the hope that it will be useful,
  763. but WITHOUT ANY WARRANTY; without even the implied warranty of
  764. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  765. GNU General Public License for more details.
  766. You should have received a copy of the GNU General Public License
  767. along with this program; if not, see <http://www.gnu.org/licenses/>. */
  768. ====================GPL-3.0-or-later====================
  769. This program is free software; you can redistribute it and/or modify
  770. it under the terms of the GNU General Public License as published by
  771. the Free Software Foundation; either version 3, or (at your option)
  772. any later version.
  773. This program is distributed in the hope that it will be useful,
  774. but WITHOUT ANY WARRANTY; without even the implied warranty of
  775. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  776. GNU General Public License for more details.
  777. You should have received a copy of the GNU General Public License
  778. along with this program; if not, see <https://www.gnu.org/licenses/>. */
  779. ====================GPL-3.0-or-later====================
  780. This program is free software; you can redistribute it and/or modify
  781. it under the terms of the GNU General Public License as published by
  782. the Free Software Foundation; either version 3, or (at your option)
  783. any later version.
  784. This program is distributed in the hope that it will be useful,
  785. but WITHOUT ANY WARRANTY; without even the implied warranty of
  786. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  787. GNU General Public License for more details.
  788. You should have received a copy of the GNU General Public License along
  789. with this program; if not, see <https://www.gnu.org/licenses/>. */
  790. ====================GPL-3.0-or-later====================
  791. This program is free software; you can redistribute it and/or modify it
  792. under the terms of the GNU General Public License as published
  793. by the Free Software Foundation; either version 3, or (at your option)
  794. any later version.
  795. This program is distributed in the hope that it will be useful,
  796. but WITHOUT ANY WARRANTY; without even the implied warranty of
  797. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  798. General Public License for more details.
  799. You should have received a copy of the GNU General Public
  800. License along with this program; if not, see
  801. <http://www.gnu.org/licenses/>.
  802. ====================GPL-3.0-or-later====================
  803. This program is free software; you can redistribute it and/or modify it
  804. under the terms of the GNU General Public License as published by the
  805. Free Software Foundation; either version 3, or (at your option) any
  806. later version.
  807. This program is distributed in the hope that it will be useful,
  808. but WITHOUT ANY WARRANTY; without even the implied warranty of
  809. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  810. GNU General Public License for more details.
  811. You should have received a copy of the GNU General Public License
  812. along with this program; if not, see <https://www.gnu.org/licenses/>. */
  813. ====================GPL-3.0-or-later====================
  814. This program is free software: you can redistribute it and/or modify
  815. it under the terms of the GNU General Public License as published by
  816. the Free Software Foundation; either version 3 of the License, or
  817. (at your option) any later version.
  818. This program is distributed in the hope that it will be useful,
  819. but WITHOUT ANY WARRANTY; without even the implied warranty of
  820. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  821. GNU General Public License for more details.
  822. You should have received a copy of the GNU General Public License
  823. along with this program. If not, see <https://www.gnu.org/licenses/>. */
  824. ====================GPL-3.0-or-later====================
  825. This program is free software; you can redistribute it and/or modify
  826. it under the terms of the GNU General Public License as published by
  827. the Free Software Foundation; either version 3 of the License, or
  828. (at your option) any later version.
  829. This program is distributed in the hope that it will be useful,
  830. but WITHOUT ANY WARRANTY; without even the implied warranty of
  831. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  832. GNU General Public License for more details.
  833. You should have received a copy of the GNU General Public License
  834. along with this program; if not, see <https://www.gnu.org/licenses/>. */