]> git.sur5r.net Git - openldap/blob - libraries/liblber/memory.c
subtreeSpecification syntax change : -binary +validator
[openldap] / libraries / liblber / memory.c
1 /* $OpenLDAP$ */
2 /*
3  * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
4  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
5  */
6 #include "portable.h"
7
8 #include <ac/stdlib.h>
9 #include <ac/string.h>
10
11 #include "lber-int.h"
12
13 #ifdef LDAP_MEMORY_TRACE
14 # ifndef LDAP_MEMORY_DEBUG
15 #  define LDAP_MEMORY_DEBUG 1
16 # endif
17 #include <stdio.h>
18 #endif
19
20 #if LDAP_MEMORY_DEBUG
21 /*
22  * LDAP_MEMORY_DEBUG should only be enabled for the purposes of
23  * debugging memory management within OpenLDAP libraries and slapd.
24  * It should only be enabled by an experienced developer as it
25  * causes the inclusion of numerous assert()'s, many of which may
26  * be triggered by a prefectly valid program.
27  *
28  * The code behind this macro is subject to change as needed to
29  * support this testing.
30  */
31
32 struct ber_mem_hdr {
33         ber_int_t       bm_top; /* Pattern to detect buf overrun from prev buffer */
34         ber_int_t       bm_length; /* Length of user allocated area */
35 #ifdef LDAP_MEMORY_TRACE
36         ber_int_t       bm_sequence; /* Allocation sequence number */
37 #endif
38         union bmu_align_u {     /* Force alignment, pattern to detect back clobber */
39                 ber_len_t       bmu_len_t;
40                 ber_tag_t       bmu_tag_t;
41                 ber_int_t       bmu_int_t;
42
43                 size_t  bmu_size_t;
44                 void *  bmu_voidp;
45                 double  bmu_double;
46                 long    bmu_long;
47                 long    (*bmu_funcp)( double );
48                 unsigned char   bmu_char[4];
49         } ber_align;
50 #define bm_junk ber_align.bmu_len_t
51 #define bm_data ber_align.bmu_char[1]
52 #define bm_char ber_align.bmu_char
53 };
54
55 /* Pattern at top of allocated space */
56 #define LBER_MEM_JUNK 0xdeaddadaU
57
58 static const struct ber_mem_hdr ber_int_mem_hdr = { LBER_MEM_JUNK, 0, 0 };
59
60 /* Note sequence and ber_int_options.lbu_meminuse are counters, but are not
61  * thread safe.  If you want to use these values for multithreaded applications,
62  * you must put mutexes around them, otherwise they will have incorrect values.
63  * When debugging, if you sort the debug output, the sequence number will 
64  * put allocations/frees together.  It is then a simple matter to write a script
65  * to find any allocations that don't have a buffer free function.
66  */
67 #ifdef LDAP_MEMORY_TRACE
68 static ber_int_t sequence = 0;
69 #endif
70
71 /* Pattern placed just before user data */
72 static unsigned char toppattern[4] = { 0xde, 0xad, 0xba, 0xde };
73 /* Pattern placed just after user data */
74 static unsigned char endpattern[4] = { 0xd1, 0xed, 0xde, 0xca };
75
76 #define mbu_len sizeof(ber_int_mem_hdr.ber_align)
77
78 /* Test if pattern placed just before user data is good */
79 #define testdatatop(val) ( \
80         *(val->bm_char+mbu_len-4)==toppattern[0] && \
81         *(val->bm_char+mbu_len-3)==toppattern[1] && \
82         *(val->bm_char+mbu_len-2)==toppattern[2] && \
83         *(val->bm_char+mbu_len-1)==toppattern[3] )
84
85 /* Place pattern just before user data */
86 #define setdatatop(val) *(val->bm_char+mbu_len-4)=toppattern[0]; \
87         *(val->bm_char+mbu_len-3)=toppattern[1]; \
88         *(val->bm_char+mbu_len-2)=toppattern[2]; \
89         *(val->bm_char+mbu_len-1)=toppattern[3];
90
91 /* Test if pattern placed just after user data is good */
92 #define testend(val) (  *((unsigned char *)val+0)==endpattern[0] && \
93         *((unsigned char *)val+1)==endpattern[1] && \
94         *((unsigned char *)val+2)==endpattern[2] && \
95         *((unsigned char *)val+3)==endpattern[3] )
96
97 /* Place pattern just after user data */
98 #define setend(val)     *((unsigned char *)val+0)=endpattern[0]; \
99         *((unsigned char *)val+1)=endpattern[1]; \
100         *((unsigned char *)val+2)=endpattern[2]; \
101         *((unsigned char *)val+3)=endpattern[3];
102
103 #define BER_MEM_BADADDR ((void *) &ber_int_mem_hdr.bm_data)
104 #define BER_MEM_VALID(p)        do { \
105                 assert( (p) != BER_MEM_BADADDR );       \
106                 assert( (p) != (void *) &ber_int_mem_hdr );     \
107         } while(0)
108
109 #else
110 #define BER_MEM_VALID(p)        /* no-op */
111 #endif
112
113 BerMemoryFunctions *ber_int_memory_fns = NULL;
114
115 void
116 ber_memfree_x( void *p, void *ctx )
117 {
118     ber_int_options.lbo_valid = LBER_INITIALIZED;
119
120         if( p == NULL ) {
121                 return;
122         }
123
124         BER_MEM_VALID( p );
125
126         if( ber_int_memory_fns == NULL || ctx == NULL ) {
127 #ifdef LDAP_MEMORY_DEBUG
128                 struct ber_mem_hdr *mh = (struct ber_mem_hdr *)
129                         ((char *)p - sizeof(struct ber_mem_hdr));
130                 assert( mh->bm_top == LBER_MEM_JUNK);
131                 assert( testdatatop( mh));
132                 assert( testend( (char *)&mh[1] + mh->bm_length) );
133                 ber_int_options.lbo_meminuse -= mh->bm_length;
134
135 #ifdef LDAP_MEMORY_TRACE
136                 fprintf(stderr, "0x%08x 0x%08x -f- %d ber_memfree %d\n",
137                         mh->bm_sequence, mh, mh->bm_length, ber_int_options.lbo_meminuse);
138 #endif
139                 /* Fill the free space with poison */
140                 memset( mh, 0xff, mh->bm_length + sizeof(struct ber_mem_hdr) + sizeof(ber_int_t));
141                 free( mh );
142 #else
143                 free( p );
144 #endif
145                 return;
146         }
147
148         assert( ber_int_memory_fns->bmf_free );
149
150         (*ber_int_memory_fns->bmf_free)( p, ctx );
151 }
152
153 void
154 ber_memfree( void *p )
155 {
156         ber_memfree_x(p, NULL);
157 }
158
159 void
160 ber_memvfree_x( void **vec, void *ctx )
161 {
162         int     i;
163
164         ber_int_options.lbo_valid = LBER_INITIALIZED;
165
166         if( vec == NULL ) {
167                 return;
168         }
169
170         BER_MEM_VALID( vec );
171
172         for ( i = 0; vec[i] != NULL; i++ ) {
173                 ber_memfree_x( vec[i], ctx );
174         }
175
176         ber_memfree_x( vec, ctx );
177 }
178
179 void
180 ber_memvfree( void **vec )
181 {
182         ber_memvfree_x( vec, NULL );
183 }
184
185 void *
186 ber_memalloc_x( ber_len_t s, void *ctx )
187 {
188         void *new;
189         ber_int_options.lbo_valid = LBER_INITIALIZED;
190
191 #ifdef LDAP_MEMORY_DEBUG
192         assert( s != 0 );
193 #endif
194
195         if( s == 0 ) {
196                 return NULL;
197         }
198
199         if( ber_int_memory_fns == NULL || ctx == NULL ) {
200 #ifdef LDAP_MEMORY_DEBUG
201                 struct ber_mem_hdr *mh = malloc(s + sizeof(struct ber_mem_hdr) + sizeof( ber_int_t));
202                 if( mh == NULL ) return NULL;
203
204                 mh->bm_top = LBER_MEM_JUNK;
205                 mh->bm_length = s;
206                 setdatatop( mh);
207                 setend( (char *)&mh[1] + mh->bm_length );
208
209                 ber_int_options.lbo_meminuse += mh->bm_length;  /* Count mem inuse */
210
211 #ifdef LDAP_MEMORY_TRACE
212                 mh->bm_sequence = sequence++;
213                 fprintf(stderr, "0x%08x 0x%08x -a- %d ber_memalloc %d\n",
214                         mh->bm_sequence, mh, mh->bm_length, ber_int_options.lbo_meminuse);
215 #endif
216                 /* poison new memory */
217                 memset( (char *)&mh[1], 0xff, s);
218
219                 BER_MEM_VALID( &mh[1] );
220                 new = &mh[1];
221 #else
222                 new = malloc( s );
223 #endif
224         } else {
225                 new = (*ber_int_memory_fns->bmf_malloc)( s, ctx );
226         }
227
228         if( new == NULL ) {
229                 ber_errno = LBER_ERROR_MEMORY;
230         }
231
232         return new;
233 }
234
235 void *
236 ber_memalloc( ber_len_t s )
237 {
238         return ber_memalloc_x( s, NULL );
239 }
240
241 void *
242 ber_memcalloc_x( ber_len_t n, ber_len_t s, void *ctx )
243 {
244         void *new;
245         ber_int_options.lbo_valid = LBER_INITIALIZED;
246
247 #ifdef LDAP_MEMORY_DEBUG
248         assert( n != 0 && s != 0);
249 #endif
250
251         if( n == 0 || s == 0 ) {
252                 return NULL;
253         }
254
255         if( ber_int_memory_fns == NULL || ctx == NULL ) {
256 #ifdef LDAP_MEMORY_DEBUG
257                 struct ber_mem_hdr *mh = calloc(1,
258                         (n * s) + sizeof(struct ber_mem_hdr) + sizeof(ber_int_t) );
259                 if( mh == NULL ) return NULL;
260
261                 mh->bm_top = LBER_MEM_JUNK;
262                 mh->bm_length = n*s;
263                 setdatatop( mh);
264                 setend( (char *)&mh[1] + mh->bm_length );
265
266                 ber_int_options.lbo_meminuse += mh->bm_length;
267
268 #ifdef LDAP_MEMORY_TRACE
269                 mh->bm_sequence = sequence++;
270                 fprintf(stderr, "0x%08x 0x%08x -a- %d ber_memcalloc %d\n",
271                         mh->bm_sequence, mh, mh->bm_length, ber_int_options.lbo_meminuse);
272 #endif
273                 BER_MEM_VALID( &mh[1] );
274                 new = &mh[1];
275 #else
276                 new = calloc( n, s );
277 #endif
278
279         } else {
280                 new = (*ber_int_memory_fns->bmf_calloc)( n, s, ctx );
281         }
282
283         if( new == NULL ) {
284                 ber_errno = LBER_ERROR_MEMORY;
285         }
286
287         return new;
288 }
289
290 void *
291 ber_memcalloc( ber_len_t n, ber_len_t s )
292 {
293         return ber_memcalloc_x( n, s, NULL );
294 }
295
296 void *
297 ber_memrealloc_x( void* p, ber_len_t s, void *ctx )
298 {
299         void *new = NULL;
300         ber_int_options.lbo_valid = LBER_INITIALIZED;
301
302         /* realloc(NULL,s) -> malloc(s) */
303         if( p == NULL ) {
304                 return ber_memalloc_x( s, ctx );
305         }
306         
307         /* realloc(p,0) -> free(p) */
308         if( s == 0 ) {
309                 ber_memfree_x( p, ctx );
310                 return NULL;
311         }
312
313         BER_MEM_VALID( p );
314
315         if( ber_int_memory_fns == NULL || ctx == NULL ) {
316 #ifdef LDAP_MEMORY_DEBUG
317                 ber_int_t oldlen;
318                 struct ber_mem_hdr *mh = (struct ber_mem_hdr *)
319                         ((char *)p - sizeof(struct ber_mem_hdr));
320                 assert( mh->bm_top == LBER_MEM_JUNK);
321                 assert( testdatatop( mh));
322                 assert( testend( (char *)&mh[1] + mh->bm_length) );
323                 oldlen = mh->bm_length;
324
325                 p = realloc( mh, s + sizeof(struct ber_mem_hdr) + sizeof(ber_int_t) );
326                 if( p == NULL ) {
327                         ber_errno = LBER_ERROR_MEMORY;
328                         return NULL;
329                 }
330
331                         mh = p;
332                 mh->bm_length = s;
333                 setend( (char *)&mh[1] + mh->bm_length );
334                 if( (s - oldlen) > 0 ) {
335                         /* poison any new memory */
336                         memset( (char *)&mh[1] + oldlen, 0xff, s - oldlen);
337                 }
338
339                 assert( mh->bm_top == LBER_MEM_JUNK);
340                 assert( testdatatop( mh));
341
342                 ber_int_options.lbo_meminuse += s - oldlen;
343 #ifdef LDAP_MEMORY_TRACE
344                 fprintf(stderr, "0x%08x 0x%08x -a- %d ber_memrealloc %d\n",
345                         mh->bm_sequence, mh, mh->bm_length, ber_int_options.lbo_meminuse);
346 #endif
347                         BER_MEM_VALID( &mh[1] );
348                 return &mh[1];
349 #else
350                 new = realloc( p, s );
351 #endif
352         } else {
353                 new = (*ber_int_memory_fns->bmf_realloc)( p, s, ctx );
354         }
355
356         if( new == NULL ) {
357                 ber_errno = LBER_ERROR_MEMORY;
358         }
359
360         return new;
361 }
362
363 void *
364 ber_memrealloc( void* p, ber_len_t s )
365 {
366         return ber_memrealloc_x( p, s, NULL );
367 }
368
369 void
370 ber_bvfree_x( struct berval *bv, void *ctx )
371 {
372         ber_int_options.lbo_valid = LBER_INITIALIZED;
373
374         if( bv == NULL ) {
375                 return;
376         }
377
378         BER_MEM_VALID( bv );
379
380         if ( bv->bv_val != NULL ) {
381                 ber_memfree_x( bv->bv_val, ctx );
382         }
383
384         ber_memfree_x( (char *) bv, ctx );
385 }
386
387 void
388 ber_bvfree( struct berval *bv )
389 {
390         ber_bvfree_x( bv, NULL );
391 }
392
393 void
394 ber_bvecfree_x( struct berval **bv, void *ctx )
395 {
396         int     i;
397
398         ber_int_options.lbo_valid = LBER_INITIALIZED;
399
400         if( bv == NULL ) {
401                 return;
402         }
403
404         BER_MEM_VALID( bv );
405
406         for ( i = 0; bv[i] != NULL; i++ ) {
407                 ber_bvfree_x( bv[i], ctx );
408         }
409
410         ber_memfree_x( (char *) bv, ctx );
411 }
412
413 void
414 ber_bvecfree( struct berval **bv )
415 {
416         ber_bvecfree_x( bv, NULL );
417 }
418
419 int
420 ber_bvecadd_x( struct berval ***bvec, struct berval *bv, void *ctx )
421 {
422         ber_len_t i;
423         struct berval **new;
424
425         ber_int_options.lbo_valid = LBER_INITIALIZED;
426
427         if( *bvec == NULL ) {
428                 if( bv == NULL ) {
429                         /* nothing to add */
430                         return 0;
431                 }
432
433                 *bvec = ber_memalloc_x( 2 * sizeof(struct berval *), ctx );
434
435                 if( *bvec == NULL ) {
436                         return -1;
437                 }
438
439                 (*bvec)[0] = bv;
440                 (*bvec)[1] = NULL;
441
442                 return 1;
443         }
444
445         BER_MEM_VALID( bvec );
446
447         /* count entries */
448         for ( i = 0; (*bvec)[i] != NULL; i++ ) {
449                 /* EMPTY */;
450         }
451
452         if( bv == NULL ) {
453                 return i;
454         }
455
456         new = ber_memrealloc_x( *bvec, (i+2) * sizeof(struct berval *), ctx);
457
458         if( new == NULL ) {
459                 return -1;
460         }
461
462         *bvec = new;
463
464         (*bvec)[i++] = bv;
465         (*bvec)[i] = NULL;
466
467         return i;
468 }
469
470 int
471 ber_bvecadd( struct berval ***bvec, struct berval *bv )
472 {
473         return ber_bvecadd_x( bvec, bv, NULL );
474 }
475
476 struct berval *
477 ber_dupbv_x(
478         struct berval *dst, struct berval *src, void *ctx )
479 {
480         struct berval *new;
481
482         ber_int_options.lbo_valid = LBER_INITIALIZED;
483
484         if( src == NULL ) {
485                 ber_errno = LBER_ERROR_PARAM;
486                 return NULL;
487         }
488
489         if ( dst ) {
490                 new = dst;
491         } else {
492                 if(( new = ber_memalloc_x( sizeof(struct berval), ctx )) == NULL ) {
493                         ber_errno = LBER_ERROR_MEMORY;
494                         return NULL;
495                 }
496         }
497
498         if ( src->bv_val == NULL ) {
499                 new->bv_val = NULL;
500                 new->bv_len = 0;
501                 return new;
502         }
503
504         if(( new->bv_val = ber_memalloc_x( src->bv_len + 1, ctx )) == NULL ) {
505                 ber_errno = LBER_ERROR_MEMORY;
506                 if ( !dst )
507                         ber_memfree_x( new, ctx );
508                 return NULL;
509         }
510
511         AC_MEMCPY( new->bv_val, src->bv_val, src->bv_len );
512         new->bv_val[src->bv_len] = '\0';
513         new->bv_len = src->bv_len;
514
515         return new;
516 }
517
518 struct berval *
519 ber_dupbv(
520         struct berval *dst, struct berval *src )
521 {
522         return ber_dupbv_x( dst, src, NULL );
523 }
524
525 struct berval *
526 ber_bvdup(
527         struct berval *src )
528 {
529         return ber_dupbv_x( NULL, src, NULL );
530 }
531
532 struct berval *
533 ber_str2bv_x(
534         LDAP_CONST char *s, ber_len_t len, int dup, struct berval *bv,
535         void *ctx)
536 {
537         struct berval *new;
538
539         ber_int_options.lbo_valid = LBER_INITIALIZED;
540
541         if( s == NULL ) {
542                 ber_errno = LBER_ERROR_PARAM;
543                 return NULL;
544         }
545
546         if( bv ) {
547                 new = bv;
548         } else {
549                 if(( new = ber_memalloc_x( sizeof(struct berval), ctx )) == NULL ) {
550                         ber_errno = LBER_ERROR_MEMORY;
551                         return NULL;
552                 }
553         }
554
555         new->bv_len = len ? len : strlen( s );
556         if ( dup ) {
557                 if ( (new->bv_val = ber_memalloc_x( new->bv_len+1, ctx )) == NULL ) {
558                         ber_errno = LBER_ERROR_MEMORY;
559                         if ( !bv )
560                                 ber_memfree_x( new, ctx );
561                         return NULL;
562                 }
563
564                 AC_MEMCPY( new->bv_val, s, new->bv_len );
565                 new->bv_val[new->bv_len] = '\0';
566         } else {
567                 new->bv_val = (char *) s;
568         }
569
570         return( new );
571 }
572
573 struct berval *
574 ber_str2bv(
575         LDAP_CONST char *s, ber_len_t len, int dup, struct berval *bv)
576 {
577         return ber_str2bv_x( s, len, dup, bv, NULL );
578 }
579
580 struct berval *
581 ber_mem2bv_x(
582         LDAP_CONST char *s, ber_len_t len, int dup, struct berval *bv,
583         void *ctx)
584 {
585         struct berval *new;
586
587         ber_int_options.lbo_valid = LBER_INITIALIZED;
588
589         if( s == NULL ) {
590                 ber_errno = LBER_ERROR_PARAM;
591                 return NULL;
592         }
593
594         if( bv ) {
595                 new = bv;
596         } else {
597                 if(( new = ber_memalloc_x( sizeof(struct berval), ctx )) == NULL ) {
598                         ber_errno = LBER_ERROR_MEMORY;
599                         return NULL;
600                 }
601         }
602
603         new->bv_len = len;
604         if ( dup ) {
605                 if ( (new->bv_val = ber_memalloc_x( new->bv_len+1, ctx )) == NULL ) {
606                         ber_errno = LBER_ERROR_MEMORY;
607                         if ( !bv )
608                                 ber_memfree_x( new, ctx );
609                         return NULL;
610                 }
611
612                 AC_MEMCPY( new->bv_val, s, new->bv_len );
613                 new->bv_val[new->bv_len] = '\0';
614         } else {
615                 new->bv_val = (char *) s;
616         }
617
618         return( new );
619 }
620
621 struct berval *
622 ber_mem2bv(
623         LDAP_CONST char *s, ber_len_t len, int dup, struct berval *bv)
624 {
625         return ber_mem2bv_x( s, len, dup, bv, NULL );
626 }
627
628 char *
629 ber_strdup_x( LDAP_CONST char *s, void *ctx )
630 {
631         char    *p;
632         size_t  len;
633         
634         ber_int_options.lbo_valid = LBER_INITIALIZED;
635
636 #ifdef LDAP_MEMORY_DEBUG
637         assert(s != NULL);                      /* bv damn better point to something */
638 #endif
639
640         if( s == NULL ) {
641                 ber_errno = LBER_ERROR_PARAM;
642                 return NULL;
643         }
644
645         len = strlen( s ) + 1;
646
647         if ( (p = ber_memalloc_x( len, ctx )) == NULL ) {
648                 ber_errno = LBER_ERROR_MEMORY;
649                 return NULL;
650         }
651
652         AC_MEMCPY( p, s, len );
653         return p;
654 }
655
656 char *
657 ber_strdup( LDAP_CONST char *s )
658 {
659         return ber_strdup_x( s, NULL );
660 }
661
662 char *
663 ber_strndup_x( LDAP_CONST char *s, ber_len_t l, void *ctx )
664 {
665         char    *p;
666         size_t  len;
667         
668         ber_int_options.lbo_valid = LBER_INITIALIZED;
669
670 #ifdef LDAP_MEMORY_DEBUG
671         assert(s != NULL);                      /* bv damn better point to something */
672 #endif
673
674         if( s == NULL ) {
675                 ber_errno = LBER_ERROR_PARAM;
676                 return NULL;
677         }
678
679         len = strlen( s );
680
681         if ( len > l ) {
682                 len = l;
683         }
684
685         if ( (p = ber_memalloc_x( len + 1, ctx )) == NULL ) {
686                 ber_errno = LBER_ERROR_MEMORY;
687                 return NULL;
688         }
689
690         AC_MEMCPY( p, s, len );
691         p[ len ] = '\0';
692         return p;
693 }
694
695 char *
696 ber_strndup( LDAP_CONST char *s, ber_len_t l )
697 {
698         return ber_strndup_x( s, l, NULL );
699 }
700
701 void
702 ber_bvarray_free_x( BerVarray a, void *ctx )
703 {
704         int i;
705
706         ber_int_options.lbo_valid = LBER_INITIALIZED;
707
708         if (a) {
709                 BER_MEM_VALID( a );
710
711                 for (i=0; a[i].bv_val; i++) {
712                         ber_memfree_x(a[i].bv_val, ctx);
713                 }
714
715                 ber_memfree_x(a, ctx);
716         }
717 }
718
719 void
720 ber_bvarray_free( BerVarray a )
721 {
722         ber_bvarray_free_x(a, NULL);
723 }
724
725 int
726 ber_bvarray_add_x( BerVarray *a, BerValue *bv, void *ctx )
727 {
728         int     n;
729
730         ber_int_options.lbo_valid = LBER_INITIALIZED;
731
732         if ( *a == NULL ) {
733                 if (bv == NULL) {
734                         return 0;
735                 }
736                 n = 0;
737
738                 *a = (BerValue *) ber_memalloc_x( 2 * sizeof(BerValue), ctx );
739                 if ( *a == NULL ) {
740                         return -1;
741                 }
742
743         } else {
744                 BerVarray atmp;
745                 BER_MEM_VALID( a );
746
747                 for ( n = 0; *a != NULL && (*a)[n].bv_val != NULL; n++ ) {
748                         ;       /* just count them */
749                 }
750
751                 if (bv == NULL) {
752                         return n;
753                 }
754
755                 atmp = (BerValue *) ber_memrealloc_x( (char *) *a,
756                     (n + 2) * sizeof(BerValue), ctx );
757
758                 if( atmp == NULL ) {
759                         return -1;
760                 }
761
762                 *a = atmp;
763         }
764
765         (*a)[n++] = *bv;
766         (*a)[n].bv_val = NULL;
767
768         return n;
769 }
770
771 int
772 ber_bvarray_add( BerVarray *a, BerValue *bv )
773 {
774         return ber_bvarray_add_x( a, bv, NULL );
775 }