ReactOS 0.4.16-dev-91-g764881a
atlsimpstr.h
Go to the documentation of this file.
1#ifndef __ATLSIMPSTR_H__
2#define __ATLSIMPSTR_H__
3
4#pragma once
5
6#include <atlcore.h>
7#include <atlexcept.h>
8
9#ifdef __RATL__
10 #ifndef _In_count_
11 #define _In_count_(nLength)
12 #endif
13#endif
14
15namespace ATL
16{
17struct CStringData;
18
19// Pure virtual interface
21{
22public:
23
24 virtual ~IAtlStringMgr() {}
25
30 ) = 0;
31
32 virtual void Free(
34 ) = 0;
35
37 CStringData* Reallocate(
41 ) = 0;
42
43 virtual CStringData* GetNilString(void) = 0;
44 virtual IAtlStringMgr* Clone(void) = 0;
45};
46
47
49{
53 long nRefs;
54
55 void* data() noexcept
56 {
57 return (this + 1);
58 }
59
60 void AddRef() noexcept
61 {
62 ATLASSERT(nRefs > 0);
64 }
65
66 void Release() noexcept
67 {
68 ATLASSERT(nRefs != 0);
69
71 {
72 pStringMgr->Free(this);
73 }
74 }
75
76 bool IsLocked() const noexcept
77 {
78 return (nRefs < 0);
79 }
80
81 bool IsShared() const noexcept
82 {
83 return (nRefs > 1);
84 }
85};
86
88 public CStringData
89{
90public:
91 CNilStringData() noexcept
92 {
94 nRefs = 2;
95 nDataLength = 0;
96 nAllocLength = 0;
97 achNil[0] = 0;
98 achNil[1] = 0;
99 }
100
101 void SetManager(_In_ IAtlStringMgr* pMgr) noexcept
102 {
104 pStringMgr = pMgr;
105 }
106
107public:
108 wchar_t achNil[2];
109};
110
111
112template< typename BaseType = char >
114{
115public:
116 typedef char XCHAR;
117 typedef LPSTR PXSTR;
118 typedef LPCSTR PCXSTR;
119 typedef wchar_t YCHAR;
120 typedef LPWSTR PYSTR;
122};
123
124template<>
126{
127public:
128 typedef wchar_t XCHAR;
129 typedef LPWSTR PXSTR;
131 typedef char YCHAR;
132 typedef LPSTR PYSTR;
133 typedef LPCSTR PCYSTR;
134};
135
136template< typename BaseType, bool t_bMFCDLL = false>
138{
139public:
146
147private:
149
150public:
152 {
153 CStringData* pData = pStringMgr->GetNilString();
154 Attach(pData);
155 }
156
158 {
159 CStringData* pSrcData = strSrc.GetData();
160 CStringData* pNewData = CloneData(pSrcData);
161 Attach(pNewData);
162 }
163
165 _In_z_ PCXSTR pszSrc,
166 _Inout_ IAtlStringMgr* pStringMgr)
167 {
168 int nLength = StringLength(pszSrc);
169 CStringData* pData = pStringMgr->Allocate(nLength, sizeof(XCHAR));
170 if (pData == NULL)
172
173 Attach(pData);
176 }
177
179 _In_count_(nLength) const XCHAR* pchSrc,
180 _In_ int nLength,
181 _Inout_ IAtlStringMgr* pStringMgr)
182 {
183 if (pchSrc == NULL && nLength != 0)
185
186 CStringData* pData = pStringMgr->Allocate(nLength, sizeof(XCHAR));
187 if (pData == NULL)
188 {
190 }
191 Attach(pData);
194 }
195
197 {
199 pData->Release();
200 }
201
203 {
204 SetString(pszSrc);
205 return *this;
206 }
207
209 {
211 CStringData* pNewData = strSrc.GetData();
212
213 if (pNewData != pData)
214 {
215 if (!pData->IsLocked() && (pNewData->pStringMgr == pData->pStringMgr))
216 {
217 pNewData = CloneData(pNewData);
218 pData->Release();
219 Attach(pNewData);
220 }
221 else
222 {
223 SetString(strSrc.GetString(), strSrc.GetLength());
224 }
225 }
226
227 return *this;
228 }
229
231 {
232 Append(strSrc);
233 return *this;
234 }
235
237 {
238 Append(pszSrc);
239 return *this;
240 }
241
243 {
244 Append(&ch, 1);
245 return *this;
246 }
247
248 operator PCXSTR() const noexcept
249 {
250 return m_pszData;
251 }
252
253 void Empty() noexcept
254 {
255 CStringData* pOldData = GetData();
256 IAtlStringMgr* pStringMgr = pOldData->pStringMgr;
257 if (pOldData->nDataLength == 0) return;
258
259 if (pOldData->IsLocked())
260 {
261 SetLength(0);
262 }
263 else
264 {
265 pOldData->Release();
266 CStringData* pNewData = pStringMgr->GetNilString();
267 Attach(pNewData);
268 }
269 }
270
271 void Append(
272 _In_count_(nLength) PCXSTR pszSrc,
273 _In_ int nLength)
274 {
275 UINT_PTR nOffset = pszSrc - GetString();
276
277 int nOldLength = GetLength();
278 if (nOldLength < 0)
279 nOldLength = 0;
280
281 ATLASSERT(nLength >= 0);
282
283#if 0 // FIXME: See comment for StringLengthN below.
284 nLength = StringLengthN(pszSrc, nLength);
285 if (!(INT_MAX - nLength >= nOldLength))
286 throw;
287#endif
288
289 int nNewLength = nOldLength + nLength;
290 PXSTR pszBuffer = GetBuffer(nNewLength);
291 if (nOffset <= (UINT_PTR)nOldLength)
292 {
293 pszSrc = pszBuffer + nOffset;
294 }
295 CopyChars(pszBuffer + nOldLength, nLength, pszSrc, nLength);
296 ReleaseBufferSetLength(nNewLength);
297 }
298
299 void Append(_In_z_ PCXSTR pszSrc)
300 {
301 Append(pszSrc, StringLength(pszSrc));
302 }
303
304 void Append(_In_ const CSimpleStringT& strSrc)
305 {
306 Append(strSrc.GetString(), strSrc.GetLength());
307 }
308
310 {
311 SetString(pszSrc, StringLength(pszSrc));
312 }
313
315 _In_ int nLength)
316 {
317 if (nLength == 0)
318 {
319 Empty();
320 }
321 else
322 {
323 UINT nOldLength = GetLength();
324 UINT_PTR nOffset = pszSrc - GetString();
325
326 PXSTR pszBuffer = GetBuffer(nLength);
327 if (nOffset <= nOldLength)
328 {
330 pszBuffer + nOffset, nLength);
331 }
332 else
333 {
334 CopyChars(pszBuffer, GetAllocLength(), pszSrc, nLength);
335 }
337 }
338 }
339
341 {
343 if (pData->IsShared())
344 {
345 // We should fork here
346 Fork(pData->nDataLength);
347 }
348
349 return m_pszData;
350 }
351
352 _Ret_notnull_ _Post_writable_size_(nMinBufferLength + 1) PXSTR GetBuffer(_In_ int nMinBufferLength)
353 {
354 return PrepareWrite(nMinBufferLength);
355 }
356
357 int GetAllocLength() const noexcept
358 {
359 return GetData()->nAllocLength;
360 }
361
362 int GetLength() const noexcept
363 {
364 return GetData()->nDataLength;
365 }
366
367 PXSTR GetString() noexcept
368 {
369 return m_pszData;
370 }
372 {
373 return m_pszData;
374 }
375
377 {
379 }
380
381 void ReleaseBufferSetLength(_In_ int nNewLength)
382 {
383 ATLASSERT(nNewLength >= 0);
384 SetLength(nNewLength);
385 }
386
387 void ReleaseBuffer(_In_ int nNewLength = -1)
388 {
389 if (nNewLength < 0)
390 nNewLength = StringLength(m_pszData);
391 ReleaseBufferSetLength(nNewLength);
392 }
393
394 bool IsEmpty() const noexcept
395 {
396 return (GetLength() == 0);
397 }
398
400 {
401 return (reinterpret_cast<CStringData*>(m_pszData) - 1);
402 }
403
405 {
406 IAtlStringMgr* pStringMgr = GetData()->pStringMgr;
407 return (pStringMgr ? pStringMgr->Clone() : NULL);
408 }
409
410public:
412 _In_ const CSimpleStringT& str1,
413 _In_ const CSimpleStringT& str2)
414 {
415 CSimpleStringT s(str1.GetManager());
416 Concatenate(s, str1, str1.GetLength(), str2, str2.GetLength());
417 return s;
418 }
419
421 _In_ const CSimpleStringT& str1,
422 _In_z_ PCXSTR psz2)
423 {
424 CSimpleStringT s(str1.GetManager());
425 Concatenate(s, str1, str1.GetLength(), psz2, StringLength(psz2));
426 return s;
427 }
428
430 _In_z_ PCXSTR psz1,
431 _In_ const CSimpleStringT& str2)
432 {
433 CSimpleStringT s(str2.GetManager());
434 Concatenate(s, psz1, StringLength(psz1), str2, str2.GetLength());
435 return s;
436 }
437
438 static void __cdecl CopyChars(
439 _Out_writes_to_(nDestLen, nChars) XCHAR* pchDest,
440 _In_ size_t nDestLen,
441 _In_reads_opt_(nChars) const XCHAR* pchSrc,
442 _In_ int nChars) noexcept
443 {
444 memcpy(pchDest, pchSrc, nChars * sizeof(XCHAR));
445 }
446
448 _Out_writes_to_(nDestLen, nDestLen) XCHAR* pchDest,
449 _In_ size_t nDestLen,
450 _In_reads_(nChars) const XCHAR* pchSrc,
451 _In_ int nChars) noexcept
452 {
453 memmove(pchDest, pchSrc, nChars * sizeof(XCHAR));
454 }
455
456 static int __cdecl StringLength(_In_opt_z_ const char* psz) noexcept
457 {
458 if (psz == NULL) return 0;
459 return (int)strlen(psz);
460 }
461
462 static int __cdecl StringLength(_In_opt_z_ const wchar_t* psz) noexcept
463 {
464 if (psz == NULL) return 0;
465 return (int)wcslen(psz);
466 }
467
468#if 0 // For whatever reason we do not link with strnlen / wcsnlen. Please investigate!
469 // strnlen / wcsnlen are available in MSVCRT starting Vista+.
470 static int __cdecl StringLengthN(
471 _In_opt_z_count_(sizeInXChar) const char* psz,
472 _In_ size_t sizeInXChar) noexcept
473 {
474 if (psz == NULL) return 0;
475 return (int)strnlen(psz, sizeInXChar);
476 }
477
478 static int __cdecl StringLengthN(
479 _In_opt_z_count_(sizeInXChar) const wchar_t* psz,
480 _In_ size_t sizeInXChar) noexcept
481 {
482 if (psz == NULL) return 0;
483 return (int)wcsnlen(psz, sizeInXChar);
484 }
485#endif
486
487protected:
488 static void __cdecl Concatenate(
489 _Inout_ CSimpleStringT& strResult,
490 _In_count_(nLength1) PCXSTR psz1,
491 _In_ int nLength1,
492 _In_count_(nLength2) PCXSTR psz2,
493 _In_ int nLength2)
494 {
495 int nNewLength = nLength1 + nLength2;
496 PXSTR pszBuffer = strResult.GetBuffer(nNewLength);
497 CopyChars(pszBuffer, nLength1, psz1, nLength1);
498 CopyChars(pszBuffer + nLength1, nLength2, psz2, nLength2);
499 strResult.ReleaseBufferSetLength(nNewLength);
500 }
501
502private:
504 {
505 m_pszData = static_cast<PXSTR>(pData->data());
506 }
507
509 {
510 CStringData* pOldData = GetData();
511 int nOldLength = pOldData->nDataLength;
512 CStringData* pNewData = pOldData->pStringMgr->Clone()->Allocate(nLength, sizeof(XCHAR));
513 if (pNewData == NULL)
514 {
516 }
517 int nCharsToCopy = ((nOldLength < nLength) ? nOldLength : nLength) + 1;
518 CopyChars(PXSTR(pNewData->data()), nCharsToCopy,
519 PCXSTR(pOldData->data()), nCharsToCopy);
520 pNewData->nDataLength = nOldLength;
521 pOldData->Release();
522 Attach(pNewData);
523 }
524
526 {
527 CStringData* pOldData = GetData();
528 int nShared = 1 - pOldData->nRefs;
529 int nTooShort = pOldData->nAllocLength - nLength;
530 if ((nShared | nTooShort) < 0)
531 {
533 }
534
535 return m_pszData;
536 }
538 {
539 CStringData* pOldData = GetData();
540 if (pOldData->nDataLength > nLength)
541 {
542 nLength = pOldData->nDataLength;
543 }
544 if (pOldData->IsShared())
545 {
546 Fork(nLength);
547 //ATLASSERT(FALSE);
548 }
549 else if (pOldData->nAllocLength < nLength)
550 {
551 int nNewLength = pOldData->nAllocLength;
552 if (nNewLength > 1024 * 1024 * 1024)
553 {
554 nNewLength += 1024 * 1024;
555 }
556 else
557 {
558 nNewLength = nNewLength + nNewLength / 2;
559 }
560 if (nNewLength < nLength)
561 {
562 nNewLength = nLength;
563 }
564 Reallocate(nNewLength);
565 }
566 }
567
569 {
570 CStringData* pOldData = GetData();
571 ATLASSERT(pOldData->nAllocLength < nLength);
572 IAtlStringMgr* pStringMgr = pOldData->pStringMgr;
573 if (pOldData->nAllocLength >= nLength || nLength <= 0)
574 {
575 return;
576 }
577 CStringData* pNewData = pStringMgr->Reallocate(pOldData, nLength, sizeof(XCHAR));
578 if (pNewData == NULL)
579 {
581 }
582
583 Attach(pNewData);
584 }
585
587 {
588 ATLASSERT(nLength >= 0);
589 ATLASSERT(nLength <= GetData()->nAllocLength);
590
591 if (nLength < 0 || nLength > GetData()->nAllocLength)
592 {
594 }
595
597 m_pszData[nLength] = 0;
598 }
599
601 {
602 CStringData* pNewData = NULL;
603
604 IAtlStringMgr* pNewStringMgr = pData->pStringMgr->Clone();
605 if (!pData->IsLocked() && (pNewStringMgr == pData->pStringMgr))
606 {
607 pNewData = pData;
608 pNewData->AddRef();
609 }
610 else
611 {
612 pNewData = pNewStringMgr->Allocate(pData->nDataLength, sizeof(XCHAR));
613 if (pNewData == NULL)
614 {
616 }
617
618 pNewData->nDataLength = pData->nDataLength;
619 CopyChars(PXSTR(pNewData->data()), pData->nDataLength + 1,
620 PCXSTR(pData->data()), pData->nDataLength + 1);
621 }
622
623 return pNewData;
624 }
625
626protected:
628 {
630 }
631
633 {
635 }
636};
637
638#ifdef UNICODE
639typedef CSimpleStringT<WCHAR> CSimpleString;
640#else
642#endif
643}
644
645#endif
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define __cdecl
Definition: accygwin.h:79
#define AtlThrow(x)
Definition: atldef.h:20
CNilStringData() noexcept
Definition: atlsimpstr.h:91
void SetManager(_In_ IAtlStringMgr *pMgr) noexcept
Definition: atlsimpstr.h:101
wchar_t achNil[2]
Definition: atlsimpstr.h:108
void Append(_In_count_(nLength) PCXSTR pszSrc, _In_ int nLength)
Definition: atlsimpstr.h:271
CSimpleStringT & operator=(_In_ const CSimpleStringT &strSrc)
Definition: atlsimpstr.h:208
__declspec(noinline) void Fork(_In_ int nLength)
Definition: atlsimpstr.h:508
CSimpleStringT & operator+=(_In_z_ PCXSTR pszSrc)
Definition: atlsimpstr.h:236
CStringData * GetData() const noexcept
Definition: atlsimpstr.h:399
static void __cdecl Concatenate(_Inout_ CSimpleStringT &strResult, _In_count_(nLength1) PCXSTR psz1, _In_ int nLength1, _In_count_(nLength2) PCXSTR psz2, _In_ int nLength2)
Definition: atlsimpstr.h:488
friend CSimpleStringT operator+(_In_ const CSimpleStringT &str1, _In_z_ PCXSTR psz2)
Definition: atlsimpstr.h:420
static CStringData *__cdecl CloneData(_Inout_ CStringData *pData)
Definition: atlsimpstr.h:600
static int __cdecl StringLength(_In_opt_z_ const wchar_t *psz) noexcept
Definition: atlsimpstr.h:462
void Append(_In_ const CSimpleStringT &strSrc)
Definition: atlsimpstr.h:304
CSimpleStringT & operator=(_In_opt_z_ PCXSTR pszSrc)
Definition: atlsimpstr.h:202
void Reallocate(_In_ int nLength)
Definition: atlsimpstr.h:568
void Preallocate(_In_ int nLength)
Definition: atlsimpstr.h:376
CSimpleStringT(_In_z_ PCXSTR pszSrc, _Inout_ IAtlStringMgr *pStringMgr)
Definition: atlsimpstr.h:164
CSimpleStringT & operator+=(XCHAR ch)
Definition: atlsimpstr.h:242
void SetString(_In_reads_opt_(nLength) PCXSTR pszSrc, _In_ int nLength)
Definition: atlsimpstr.h:314
CSimpleStringT(_In_count_(nLength) const XCHAR *pchSrc, _In_ int nLength, _Inout_ IAtlStringMgr *pStringMgr)
Definition: atlsimpstr.h:178
static int __cdecl StringLength(_In_opt_z_ const char *psz) noexcept
Definition: atlsimpstr.h:456
void Attach(_Inout_ CStringData *pData) noexcept
Definition: atlsimpstr.h:503
ChTraitsBase< BaseType >::PCXSTR PCXSTR
Definition: atlsimpstr.h:142
friend CSimpleStringT operator+(_In_ const CSimpleStringT &str1, _In_ const CSimpleStringT &str2)
Definition: atlsimpstr.h:411
~CSimpleStringT() noexcept
Definition: atlsimpstr.h:196
ChTraitsBase< BaseType >::PCYSTR PCYSTR
Definition: atlsimpstr.h:145
static void __cdecl CopyCharsOverlapped(_Out_writes_to_(nDestLen, nDestLen) XCHAR *pchDest, _In_ size_t nDestLen, _In_reads_(nChars) const XCHAR *pchSrc, _In_ int nChars) noexcept
Definition: atlsimpstr.h:447
static void __cdecl CopyChars(_Out_writes_to_(nDestLen, nChars) XCHAR *pchDest, _In_ size_t nDestLen, _In_reads_opt_(nChars) const XCHAR *pchSrc, _In_ int nChars) noexcept
Definition: atlsimpstr.h:438
PCXSTR GetString() const noexcept
Definition: atlsimpstr.h:371
bool IsEmpty() const noexcept
Definition: atlsimpstr.h:394
_Ret_notnull_ _Post_writable_size_(nMinBufferLength+1) PXSTR GetBuffer(_In_ int nMinBufferLength)
Definition: atlsimpstr.h:352
ChTraitsBase< BaseType >::YCHAR YCHAR
Definition: atlsimpstr.h:143
ChTraitsBase< BaseType >::PXSTR PXSTR
Definition: atlsimpstr.h:141
void ReleaseBufferSetLength(_In_ int nNewLength)
Definition: atlsimpstr.h:381
PXSTR PrepareWrite(_In_ int nLength)
Definition: atlsimpstr.h:525
IAtlStringMgr * GetManager() const noexcept
Definition: atlsimpstr.h:404
static void ThrowInvalidArgException()
Definition: atlsimpstr.h:632
int GetAllocLength() const noexcept
Definition: atlsimpstr.h:357
CSimpleStringT(_In_ const CSimpleStringT &strSrc)
Definition: atlsimpstr.h:157
CSimpleStringT(_Inout_ IAtlStringMgr *pStringMgr)
Definition: atlsimpstr.h:151
CSimpleStringT & operator+=(_In_ const CSimpleStringT &strSrc)
Definition: atlsimpstr.h:230
void PrepareWrite2(_In_ int nLength)
Definition: atlsimpstr.h:537
ChTraitsBase< BaseType >::PYSTR PYSTR
Definition: atlsimpstr.h:144
void SetString(_In_opt_z_ PCXSTR pszSrc)
Definition: atlsimpstr.h:309
void Append(_In_z_ PCXSTR pszSrc)
Definition: atlsimpstr.h:299
void ReleaseBuffer(_In_ int nNewLength=-1)
Definition: atlsimpstr.h:387
void SetLength(_In_ int nLength)
Definition: atlsimpstr.h:586
friend CSimpleStringT operator+(_In_z_ PCXSTR psz1, _In_ const CSimpleStringT &str2)
Definition: atlsimpstr.h:429
PXSTR GetString() noexcept
Definition: atlsimpstr.h:367
static void ThrowMemoryException()
Definition: atlsimpstr.h:627
int GetLength() const noexcept
Definition: atlsimpstr.h:362
void Empty() noexcept
Definition: atlsimpstr.h:253
ChTraitsBase< BaseType >::XCHAR XCHAR
Definition: atlsimpstr.h:140
virtual void Free(_Inout_ CStringData *pData)=0
virtual _Ret_maybenull_ _In_ int nCharSize
Definition: atlsimpstr.h:30
virtual CStringData * GetNilString(void)=0
virtual _Ret_maybenull_ _Post_writable_byte_size_(sizeof(CStringData)+nAllocLength *nCharSize) CStringData *Reallocate(_Inout_ CStringData *pData
virtual _Ret_maybenull_ _Post_writable_byte_size_(sizeof(CStringData)+nAllocLength *nCharSize) CStringData *Allocate(_In_ int nAllocLength
virtual IAtlStringMgr * Clone(void)=0
virtual _Ret_maybenull_ _In_ int nAllocLength
Definition: atlsimpstr.h:39
virtual ~IAtlStringMgr()
Definition: atlsimpstr.h:24
unsigned short wchar_t
Definition: crtdefs.h:345
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
#define NULL
Definition: types.h:112
#define noinline
Definition: types.h:64
GLdouble s
Definition: gl.h:2039
#define INT_MAX
Definition: limits.h:40
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
long __cdecl _InterlockedIncrement(_Interlocked_operand_ long volatile *_Addend)
long __cdecl _InterlockedDecrement(_Interlocked_operand_ long volatile *_Addend)
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
#define _Inout_
Definition: ms_sal.h:378
#define _Ret_maybenull_
Definition: ms_sal.h:529
#define _In_count_(size)
Definition: ms_sal.h:810
#define _In_z_
Definition: ms_sal.h:313
#define _In_opt_z_count_(size)
Definition: ms_sal.h:826
#define _In_opt_z_
Definition: ms_sal.h:314
#define _In_reads_opt_(size)
Definition: ms_sal.h:320
#define _Ret_notnull_
Definition: ms_sal.h:528
#define _In_
Definition: ms_sal.h:308
#define _Out_writes_to_(size, count)
Definition: ms_sal.h:355
#define _In_reads_(size)
Definition: ms_sal.h:319
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
Definition: rosdlgs.h:6
CSimpleStringT< CHAR > CSimpleString
Definition: atlsimpstr.h:641
unsigned int UINT
Definition: ndis.h:50
bool IsLocked() const noexcept
Definition: atlsimpstr.h:76
void * data() noexcept
Definition: atlsimpstr.h:55
bool IsShared() const noexcept
Definition: atlsimpstr.h:81
void AddRef() noexcept
Definition: atlsimpstr.h:60
IAtlStringMgr * pStringMgr
Definition: atlsimpstr.h:50
void Release() noexcept
Definition: atlsimpstr.h:66
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1830
_In_ DWORD nLength
Definition: wincon.h:473
_In_opt_ PALLOCATE_FUNCTION Allocate
Definition: exfuncs.h:814
const char * LPCSTR
Definition: xmlstorage.h:183
char * LPSTR
Definition: xmlstorage.h:182
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define const
Definition: zconf.h:233