File: 0001-assert_always_on.patch

package info (click to toggle)
chromium 139.0.7258.127-2
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 6,122,156 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (509 lines) | stat: -rw-r--r-- 17,565 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
diff --git a/third_party/libtess2/src/Source/geom.c b/third_party/libtess2/src/Source/geom.c
index ce232cfcbe891..4b45b8a6cbb00 100644
--- a/third_party/libtess2/src/Source/geom.c
+++ b/third_party/libtess2/src/Source/geom.c
@@ -30,7 +30,7 @@
 */
 
 //#include "tesos.h"
-#include <assert.h>
+#include "libtess2/tess_assert.h"
 #include "mesh.h"
 #include "geom.h"
 #include <math.h>
@@ -56,7 +56,7 @@ TESSreal tesedgeEval( TESSvertex *u, TESSvertex *v, TESSvertex *w )
 	*/
 	TESSreal gapL, gapR;
 
-	assert( VertLeq( u, v ) && VertLeq( v, w ));
+	tess_assert( VertLeq( u, v ) && VertLeq( v, w ));
 
 	gapL = v->s - u->s;
 	gapR = w->s - v->s;
@@ -80,7 +80,7 @@ TESSreal tesedgeSign( TESSvertex *u, TESSvertex *v, TESSvertex *w )
 	*/
 	TESSreal gapL, gapR;
 
-	assert( VertLeq( u, v ) && VertLeq( v, w ));
+	tess_assert( VertLeq( u, v ) && VertLeq( v, w ));
 
 	gapL = v->s - u->s;
 	gapR = w->s - v->s;
@@ -111,7 +111,7 @@ TESSreal testransEval( TESSvertex *u, TESSvertex *v, TESSvertex *w )
 	*/
 	TESSreal gapL, gapR;
 
-	assert( TransLeq( u, v ) && TransLeq( v, w ));
+	tess_assert( TransLeq( u, v ) && TransLeq( v, w ));
 
 	gapL = v->t - u->t;
 	gapR = w->t - v->t;
@@ -135,7 +135,7 @@ TESSreal testransSign( TESSvertex *u, TESSvertex *v, TESSvertex *w )
 	*/
 	TESSreal gapL, gapR;
 
-	assert( TransLeq( u, v ) && TransLeq( v, w ));
+	tess_assert( TransLeq( u, v ) && TransLeq( v, w ));
 
 	gapL = v->t - u->t;
 	gapR = w->t - v->t;
diff --git a/third_party/libtess2/src/Source/mesh.c b/third_party/libtess2/src/Source/mesh.c
index 763fecabd3923..5cd623fbadd59 100644
--- a/third_party/libtess2/src/Source/mesh.c
+++ b/third_party/libtess2/src/Source/mesh.c
@@ -31,7 +31,7 @@
 
 //#include "tesos.h"
 #include <stddef.h>
-#include <assert.h>
+#include "libtess2/tess_assert.h"
 #include "mesh.h"
 #include "geom.h"
 #include "bucketalloc.h"
@@ -124,7 +124,7 @@ static void MakeVertex( TESSvertex *newVertex,
 	TESSvertex *vPrev;
 	TESSvertex *vNew = newVertex;
 
-	assert(vNew != NULL);
+	tess_assert(vNew != NULL);
 
 	/* insert in circular doubly-linked list before vNext */
 	vPrev = vNext->prev;
@@ -156,7 +156,7 @@ static void MakeFace( TESSface *newFace, TESShalfEdge *eOrig, TESSface *fNext )
 	TESSface *fPrev;
 	TESSface *fNew = newFace;
 
-	assert(fNew != NULL); 
+	tess_assert(fNew != NULL); 
 
 	/* insert in circular doubly-linked list before fNext */
 	fPrev = fNext->prev;
@@ -765,9 +765,9 @@ void tessMeshFlipEdge( TESSmesh *mesh, TESShalfEdge *edge )
 	TESSface *fa = a0->Lface;
 	TESSface *fb = b0->Lface;
 
-	assert(EdgeIsInternal(edge));
-	assert(a2->Lnext == a0);
-	assert(b2->Lnext == b0);
+	tess_assert(EdgeIsInternal(edge));
+	tess_assert(a2->Lnext == a0);
+	tess_assert(b2->Lnext == b0);
 
 	a0->Org = bOpp;
 	a0->Onext = b1->Sym;
@@ -795,35 +795,35 @@ void tessMeshFlipEdge( TESSmesh *mesh, TESShalfEdge *edge )
 	if (aOrg->anEdge == a0) aOrg->anEdge = b1;
 	if (bOrg->anEdge == b0) bOrg->anEdge = a1;
 
-	assert( a0->Lnext->Onext->Sym == a0 );
-	assert( a0->Onext->Sym->Lnext == a0 );
-	assert( a0->Org->anEdge->Org == a0->Org );
+	tess_assert( a0->Lnext->Onext->Sym == a0 );
+	tess_assert( a0->Onext->Sym->Lnext == a0 );
+	tess_assert( a0->Org->anEdge->Org == a0->Org );
 
 
-	assert( a1->Lnext->Onext->Sym == a1 );
-	assert( a1->Onext->Sym->Lnext == a1 );
-	assert( a1->Org->anEdge->Org == a1->Org );
+	tess_assert( a1->Lnext->Onext->Sym == a1 );
+	tess_assert( a1->Onext->Sym->Lnext == a1 );
+	tess_assert( a1->Org->anEdge->Org == a1->Org );
 
-	assert( a2->Lnext->Onext->Sym == a2 );
-	assert( a2->Onext->Sym->Lnext == a2 );
-	assert( a2->Org->anEdge->Org == a2->Org );
+	tess_assert( a2->Lnext->Onext->Sym == a2 );
+	tess_assert( a2->Onext->Sym->Lnext == a2 );
+	tess_assert( a2->Org->anEdge->Org == a2->Org );
 
-	assert( b0->Lnext->Onext->Sym == b0 );
-	assert( b0->Onext->Sym->Lnext == b0 );
-	assert( b0->Org->anEdge->Org == b0->Org );
+	tess_assert( b0->Lnext->Onext->Sym == b0 );
+	tess_assert( b0->Onext->Sym->Lnext == b0 );
+	tess_assert( b0->Org->anEdge->Org == b0->Org );
 
-	assert( b1->Lnext->Onext->Sym == b1 );
-	assert( b1->Onext->Sym->Lnext == b1 );
-	assert( b1->Org->anEdge->Org == b1->Org );
+	tess_assert( b1->Lnext->Onext->Sym == b1 );
+	tess_assert( b1->Onext->Sym->Lnext == b1 );
+	tess_assert( b1->Org->anEdge->Org == b1->Org );
 
-	assert( b2->Lnext->Onext->Sym == b2 );
-	assert( b2->Onext->Sym->Lnext == b2 );
-	assert( b2->Org->anEdge->Org == b2->Org );
+	tess_assert( b2->Lnext->Onext->Sym == b2 );
+	tess_assert( b2->Onext->Sym->Lnext == b2 );
+	tess_assert( b2->Org->anEdge->Org == b2->Org );
 
-	assert(aOrg->anEdge->Org == aOrg);
-	assert(bOrg->anEdge->Org == bOrg);
+	tess_assert(aOrg->anEdge->Org == aOrg);
+	tess_assert(bOrg->anEdge->Org == bOrg);
 
-	assert(a0->Oprev->Onext->Org == a0->Org);
+	tess_assert(a0->Oprev->Onext->Org == a0->Org);
 }
 
 #ifdef DELETE_BY_ZAPPING
@@ -837,7 +837,7 @@ void tessMeshDeleteMesh( TESSalloc* alloc, TESSmesh *mesh )
 	while( fHead->next != fHead ) {
 		tessMeshZapFace( fHead->next );
 	}
-	assert( mesh->vHead.next == &mesh->vHead );
+	tess_assert( mesh->vHead.next == &mesh->vHead );
 
 	alloc->memfree( alloc->userData, mesh );
 }
@@ -871,43 +871,43 @@ void tessMeshCheckMesh( TESSmesh *mesh )
 	TESShalfEdge *e, *ePrev;
 
 	for( fPrev = fHead ; (f = fPrev->next) != fHead; fPrev = f) {
-		assert( f->prev == fPrev );
+		tess_assert( f->prev == fPrev );
 		e = f->anEdge;
 		do {
-			assert( e->Sym != e );
-			assert( e->Sym->Sym == e );
-			assert( e->Lnext->Onext->Sym == e );
-			assert( e->Onext->Sym->Lnext == e );
-			assert( e->Lface == f );
+			tess_assert( e->Sym != e );
+			tess_assert( e->Sym->Sym == e );
+			tess_assert( e->Lnext->Onext->Sym == e );
+			tess_assert( e->Onext->Sym->Lnext == e );
+			tess_assert( e->Lface == f );
 			e = e->Lnext;
 		} while( e != f->anEdge );
 	}
-	assert( f->prev == fPrev && f->anEdge == NULL );
+	tess_assert( f->prev == fPrev && f->anEdge == NULL );
 
 	for( vPrev = vHead ; (v = vPrev->next) != vHead; vPrev = v) {
-		assert( v->prev == vPrev );
+		tess_assert( v->prev == vPrev );
 		e = v->anEdge;
 		do {
-			assert( e->Sym != e );
-			assert( e->Sym->Sym == e );
-			assert( e->Lnext->Onext->Sym == e );
-			assert( e->Onext->Sym->Lnext == e );
-			assert( e->Org == v );
+			tess_assert( e->Sym != e );
+			tess_assert( e->Sym->Sym == e );
+			tess_assert( e->Lnext->Onext->Sym == e );
+			tess_assert( e->Onext->Sym->Lnext == e );
+			tess_assert( e->Org == v );
 			e = e->Onext;
 		} while( e != v->anEdge );
 	}
-	assert( v->prev == vPrev && v->anEdge == NULL );
+	tess_assert( v->prev == vPrev && v->anEdge == NULL );
 
 	for( ePrev = eHead ; (e = ePrev->next) != eHead; ePrev = e) {
-		assert( e->Sym->next == ePrev->Sym );
-		assert( e->Sym != e );
-		assert( e->Sym->Sym == e );
-		assert( e->Org != NULL );
-		assert( e->Dst != NULL );
-		assert( e->Lnext->Onext->Sym == e );
-		assert( e->Onext->Sym->Lnext == e );
+		tess_assert( e->Sym->next == ePrev->Sym );
+		tess_assert( e->Sym != e );
+		tess_assert( e->Sym->Sym == e );
+		tess_assert( e->Org != NULL );
+		tess_assert( e->Dst != NULL );
+		tess_assert( e->Lnext->Onext->Sym == e );
+		tess_assert( e->Onext->Sym->Lnext == e );
 	}
-	assert( e->Sym->next == ePrev->Sym
+	tess_assert( e->Sym->next == ePrev->Sym
 		&& e->Sym == &mesh->eHeadSym
 		&& e->Sym->Sym == e
 		&& e->Org == NULL && e->Dst == NULL
diff --git a/third_party/libtess2/src/Source/priorityq.c b/third_party/libtess2/src/Source/priorityq.c
index 62a6654535eab..1261fc83d9e05 100644
--- a/third_party/libtess2/src/Source/priorityq.c
+++ b/third_party/libtess2/src/Source/priorityq.c
@@ -31,7 +31,7 @@
 
 //#include "tesos.h"
 #include <stddef.h>
-#include <assert.h>
+#include "libtess2/tess_assert.h"
 #include "../Include/tesselator.h"
 #include "priorityq.h"
 
@@ -138,7 +138,7 @@ static void FloatDown( PriorityQHeap *pq, int curr )
 				++child;
 		}
 
-		assert(child <= pq->max);
+		tess_assert(child <= pq->max);
 
 		hChild = n[child].handle;
 		if( child > pq->size || LEQ( h[hCurr].key, h[hChild].key )) {
@@ -237,7 +237,7 @@ PQhandle pqHeapInsert( TESSalloc* alloc, PriorityQHeap *pq, PQkey keyNew )
 	if( pq->initialized ) {
 		FloatUp( pq, curr );
 	}
-	assert(free != INV_HANDLE);
+	tess_assert(free != INV_HANDLE);
 	return free;
 }
 
@@ -271,7 +271,7 @@ void pqHeapDelete( PriorityQHeap *pq, PQhandle hCurr )
 	PQhandleElem *h = pq->handles;
 	int curr;
 
-	assert( hCurr >= 1 && hCurr <= pq->max && h[hCurr].key != NULL );
+	tess_assert( hCurr >= 1 && hCurr <= pq->max && h[hCurr].key != NULL );
 
 	curr = h[hCurr].node;
 	n[curr].handle = n[pq->size].handle;
@@ -324,7 +324,7 @@ PriorityQ *pqNewPriorityQ( TESSalloc* alloc, int size, int (*leq)(PQkey key1, PQ
 /* really tessPqSortDeletePriorityQ */
 void pqDeletePriorityQ( TESSalloc* alloc, PriorityQ *pq )
 {
-	assert(pq != NULL); 
+	tess_assert(pq != NULL); 
 	if (pq->heap != NULL) pqHeapDeletePriorityQ( alloc, pq->heap );
 	if (pq->order != NULL) alloc->memfree( alloc->userData, pq->order );
 	if (pq->keys != NULL) alloc->memfree( alloc->userData, pq->keys );
@@ -410,7 +410,7 @@ int pqInit( TESSalloc* alloc, PriorityQ *pq )
 	p = pq->order;
 	r = p + pq->size - 1;
 	for( i = p; i < r; ++i ) {
-		assert( LEQ( **(i+1), **i ));
+		tess_assert( LEQ( **(i+1), **i ));
 	}
 #endif
 
@@ -445,7 +445,7 @@ PQhandle pqInsert( TESSalloc* alloc, PriorityQ *pq, PQkey keyNew )
 			}
 		}
 	}
-	assert(curr != INV_HANDLE); 
+	tess_assert(curr != INV_HANDLE); 
 	pq->keys[curr] = keyNew;
 
 	/* Negative handles index the sorted array. */
@@ -505,7 +505,7 @@ void pqDelete( PriorityQ *pq, PQhandle curr )
 		return;
 	}
 	curr = -(curr+1);
-	assert( curr < pq->max && pq->keys[curr] != NULL );
+	tess_assert( curr < pq->max && pq->keys[curr] != NULL );
 
 	pq->keys[curr] = NULL;
 	while( pq->size > 0 && *(pq->order[pq->size-1]) == NULL ) {
diff --git a/third_party/libtess2/src/Source/sweep.c b/third_party/libtess2/src/Source/sweep.c
index 8bcd839f73cc4..933c6b641f73f 100644
--- a/third_party/libtess2/src/Source/sweep.c
+++ b/third_party/libtess2/src/Source/sweep.c
@@ -29,7 +29,7 @@
 ** Author: Eric Veach, July 1994.
 */
 
-#include <assert.h>
+#include "libtess2/tess_assert.h"
 #include <stddef.h>
 #include <setjmp.h>		/* longjmp */
 
@@ -143,7 +143,7 @@ static void DeleteRegion( TESStesselator *tess, ActiveRegion *reg )
 		* deleted with zero winding number (ie. it better not get merged
 		* with a real edge).
 		*/
-		assert( reg->eUp->winding == 0 );
+		tess_assert( reg->eUp->winding == 0 );
 	}
 	reg->eUp->activeRegion = NULL;
 	dictDelete( tess->dict, reg->nodeUp );
@@ -156,7 +156,7 @@ static int FixUpperEdge( TESStesselator *tess, ActiveRegion *reg, TESShalfEdge *
 * Replace an upper edge which needs fixing (see ConnectRightVertex).
 */
 {
-	assert( reg->fixUpperEdge );
+	tess_assert( reg->fixUpperEdge );
 	if ( !tessMeshDelete( tess->mesh, reg->eUp ) ) return 0;
 	reg->fixUpperEdge = FALSE;
 	reg->eUp = newEdge;
@@ -237,7 +237,7 @@ static int IsWindingInside( TESStesselator *tess, int n )
 			return (n >= 2) || (n <= -2);
 	}
 	/*LINTED*/
-	assert( FALSE );
+	tess_assert( FALSE );
 	/*NOTREACHED*/
 
 	return( FALSE );
@@ -346,7 +346,7 @@ static void AddRightEdges( TESStesselator *tess, ActiveRegion *regUp,
 	/* Insert the new right-going edges in the dictionary */
 	e = eFirst;
 	do {
-		assert( VertLeq( e->Org, e->Dst ));
+		tess_assert( VertLeq( e->Org, e->Dst ));
 		AddRegionBelow( tess, regUp, e->Sym );
 		e = e->Onext;
 	} while ( e != eLast );
@@ -388,7 +388,7 @@ static void AddRightEdges( TESStesselator *tess, ActiveRegion *regUp,
 		ePrev = e;
 	}
 	regPrev->dirty = TRUE;
-	assert( regPrev->windingNumber - e->winding == reg->windingNumber );
+	tess_assert( regPrev->windingNumber - e->winding == reg->windingNumber );
 
 	if( cleanUp ) {
 		/* Check for intersections between newly adjacent edges. */
@@ -528,7 +528,7 @@ static int CheckForLeftSplice( TESStesselator *tess, ActiveRegion *regUp )
 	TESShalfEdge *eLo = regLo->eUp;
 	TESShalfEdge *e;
 
-	assert( ! VertEq( eUp->Dst, eLo->Dst ));
+	tess_assert( ! VertEq( eUp->Dst, eLo->Dst ));
 
 	if( VertLeq( eUp->Dst, eLo->Dst )) {
 		if( EdgeSign( eUp->Dst, eLo->Dst, eUp->Org ) < 0 ) return FALSE;
@@ -575,11 +575,11 @@ static int CheckForIntersect( TESStesselator *tess, ActiveRegion *regUp )
 	TESSvertex isect, *orgMin;
 	TESShalfEdge *e;
 
-	assert( ! VertEq( dstLo, dstUp ));
-	assert( EdgeSign( dstUp, tess->event, orgUp ) <= 0 );
-	assert( EdgeSign( dstLo, tess->event, orgLo ) >= 0 );
-	assert( orgUp != tess->event && orgLo != tess->event );
-	assert( ! regUp->fixUpperEdge && ! regLo->fixUpperEdge );
+	tess_assert( ! VertEq( dstLo, dstUp ));
+	tess_assert( EdgeSign( dstUp, tess->event, orgUp ) <= 0 );
+	tess_assert( EdgeSign( dstLo, tess->event, orgLo ) >= 0 );
+	tess_assert( orgUp != tess->event && orgLo != tess->event );
+	tess_assert( ! regUp->fixUpperEdge && ! regLo->fixUpperEdge );
 
 	if( orgUp == orgLo ) return FALSE;	/* right endpoints are the same */
 
@@ -598,10 +598,10 @@ static int CheckForIntersect( TESStesselator *tess, ActiveRegion *regUp )
 
 	tesedgeIntersect( dstUp, orgUp, dstLo, orgLo, &isect );
 	/* The following properties are guaranteed: */
-	assert( MIN( orgUp->t, dstUp->t ) <= isect.t );
-	assert( isect.t <= MAX( orgLo->t, dstLo->t ));
-	assert( MIN( dstLo->s, dstUp->s ) <= isect.s );
-	assert( isect.s <= MAX( orgLo->s, orgUp->s ));
+	tess_assert( MIN( orgUp->t, dstUp->t ) <= isect.t );
+	tess_assert( isect.t <= MAX( orgLo->t, dstLo->t ));
+	tess_assert( MIN( dstLo->s, dstUp->s ) <= isect.s );
+	tess_assert( isect.s <= MAX( orgLo->s, orgUp->s ));
 
 	if( VertLeq( &isect, tess->event )) {
 		/* The intersection point lies slightly to the left of the sweep line,
@@ -904,7 +904,7 @@ static void ConnectLeftDegenerate( TESStesselator *tess,
 		/* e->Org is an unprocessed vertex - just combine them, and wait
 		* for e->Org to be pulled from the queue
 		*/
-		assert( TOLERANCE_NONZERO );
+		tess_assert( TOLERANCE_NONZERO );
 		SpliceMergeVertices( tess, e, vEvent->anEdge );
 		return;
 	}
@@ -925,7 +925,7 @@ static void ConnectLeftDegenerate( TESStesselator *tess,
 	/* vEvent coincides with e->Dst, which has already been processed.
 	* Splice in the additional right-going edges.
 	*/
-	assert( TOLERANCE_NONZERO );
+	tess_assert( TOLERANCE_NONZERO );
 	regUp = TopRightRegion( regUp );
 	reg = RegionBelow( regUp );
 	eTopRight = reg->eUp->Sym;
@@ -934,7 +934,7 @@ static void ConnectLeftDegenerate( TESStesselator *tess,
 		/* Here e->Dst has only a single fixable edge going right.
 		* We can delete it since now we have some real right-going edges.
 		*/
-		assert( eTopLeft != eTopRight );   /* there are some left edges too */
+		tess_assert( eTopLeft != eTopRight );   /* there are some left edges too */
 		DeleteRegion( tess, reg );
 		if ( !tessMeshDelete( tess->mesh, eTopRight ) ) longjmp(tess->env,1);
 		eTopRight = eTopLeft->Oprev;
@@ -1143,9 +1143,7 @@ static void InitEdgeDict( TESStesselator *tess )
 static void DoneEdgeDict( TESStesselator *tess )
 {
 	ActiveRegion *reg;
-#ifndef NDEBUG
 	int fixedEdges = 0;
-#endif
 
 	while( (reg = (ActiveRegion *)dictKey( dictMin( tess->dict ))) != NULL ) {
 		/*
@@ -1144,10 +1144,10 @@ static void DoneEdgeDict( TESStesselator *tess )
 		* created by ConnectRightVertex().
 		*/
 		if( ! reg->sentinel ) {
-			assert( reg->fixUpperEdge );
-			assert( ++fixedEdges == 1 );
+			tess_assert( reg->fixUpperEdge );
+			tess_assert( ++fixedEdges == 1 );
 		}
-		assert( reg->windingNumber == 0 );
+		tess_assert( reg->windingNumber == 0 );
 		DeleteRegion( tess, reg );
 		/*    tessMeshDelete( reg->eUp );*/
 	}
@@ -1254,7 +1254,7 @@ static int RemoveDegenerateFaces( TESStesselator *tess, TESSmesh *mesh )
 	for( f = mesh->fHead.next; f != &mesh->fHead; f = fNext ) {
 		fNext = f->next;
 		e = f->anEdge;
-		assert( e->Lnext != e );
+		tess_assert( e->Lnext != e );
 
 		if( e->Lnext->Lnext == e ) {
 			/* A face with only two edges */
diff --git a/third_party/libtess2/src/Source/tess.c b/third_party/libtess2/src/Source/tess.c
index 5f47f8de0660b..fd6d9c2a1cdf2 100644
--- a/third_party/libtess2/src/Source/tess.c
+++ b/third_party/libtess2/src/Source/tess.c
@@ -30,7 +30,7 @@
 */
 
 #include <stddef.h>
-#include <assert.h>
+#include "libtess2/tess_assert.h"
 #include <setjmp.h>
 #include "bucketalloc.h"
 #include "tess.h"
@@ -51,7 +51,7 @@ static void Normalize( TESSreal v[3] )
 {
 	TESSreal len = v[0]*v[0] + v[1]*v[1] + v[2]*v[2];
 
-	assert( len > 0 );
+	tess_assert( len > 0 );
 	len = sqrtf( len );
 	v[0] /= len;
 	v[1] /= len;
@@ -328,7 +328,7 @@ int tessMeshTessellateMonoRegion( TESSmesh *mesh, TESSface *face )
 	* be close to the edge we want.
 	*/
 	up = face->anEdge;
-	assert( up->Lnext != up && up->Lnext->Lnext != up );
+	tess_assert( up->Lnext != up && up->Lnext->Lnext != up );
 
 	for( ; VertLeq( up->Dst, up->Org ); up = up->Lprev )
 		;
@@ -364,7 +364,7 @@ int tessMeshTessellateMonoRegion( TESSmesh *mesh, TESSface *face )
 	/* Now lo->Org == up->Dst == the leftmost vertex.  The remaining region
 	* can be tessellated in a fan from this leftmost vertex.
 	*/
-	assert( lo->Lnext != up );
+	tess_assert( lo->Lnext != up );
 	while( lo->Lnext->Lnext != up ) {
 		TESShalfEdge *tempHalfEdge= tessMeshConnect( mesh, lo->Lnext, lo );
 		if (tempHalfEdge == NULL) return 0;
@@ -740,7 +740,7 @@ void OutputPolymesh( TESStesselator *tess, TESSmesh *mesh, int elementType, int
 		}
 		while (edge != f->anEdge);
 
-		assert( faceVerts <= polySize );
+		tess_assert( faceVerts <= polySize );
 
 		f->n = maxFaceCount;
 		++maxFaceCount;