OLD | NEW |
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | 1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 /* This Source Code Form is subject to the terms of the Mozilla Public | 2 /* This Source Code Form is subject to the terms of the Mozilla Public |
3 * License, v. 2.0. If a copy of the MPL was not distributed with this | 3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
5 | 5 |
6 /* | 6 /* |
7 ** prcountr.c -- NSPR Instrumentation Counters | 7 ** prcountr.c -- NSPR Instrumentation Counters |
8 ** | 8 ** |
9 ** Implement the interface defined in prcountr.h | 9 ** Implement the interface defined in prcountr.h |
10 ** | 10 ** |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 if (!PR_CLIST_IS_EMPTY( &qNameList )) | 138 if (!PR_CLIST_IS_EMPTY( &qNameList )) |
139 { | 139 { |
140 qnp = (QName *) PR_LIST_HEAD( &qNameList ); | 140 qnp = (QName *) PR_LIST_HEAD( &qNameList ); |
141 do { | 141 do { |
142 if ( strcmp(qnp->name, qName) == 0) | 142 if ( strcmp(qnp->name, qName) == 0) |
143 { | 143 { |
144 matchQname = PR_TRUE; | 144 matchQname = PR_TRUE; |
145 break; | 145 break; |
146 } | 146 } |
147 qnp = (QName *)PR_NEXT_LINK( &qnp->link ); | 147 qnp = (QName *)PR_NEXT_LINK( &qnp->link ); |
148 } while( qnp != (QName *)PR_LIST_HEAD( &qNameList )); | 148 } while( qnp != (QName *)&qNameList ); |
149 } | 149 } |
150 /* | 150 /* |
151 ** If we did not find a matching QName, | 151 ** If we did not find a matching QName, |
152 ** allocate one and initialize it. | 152 ** allocate one and initialize it. |
153 ** link it onto the qNameList. | 153 ** link it onto the qNameList. |
154 ** | 154 ** |
155 */ | 155 */ |
156 if ( matchQname != PR_TRUE ) | 156 if ( matchQname != PR_TRUE ) |
157 { | 157 { |
158 qnp = PR_NEWZAP( QName ); | 158 qnp = PR_NEWZAP( QName ); |
159 PR_ASSERT( qnp != NULL ); | 159 PR_ASSERT( qnp != NULL ); |
160 PR_INIT_CLIST( &qnp->link ); | 160 PR_INIT_CLIST( &qnp->link ); |
161 PR_INIT_CLIST( &qnp->rNameList ); | 161 PR_INIT_CLIST( &qnp->rNameList ); |
162 strcpy( qnp->name, qName ); | 162 strcpy( qnp->name, qName ); |
163 PR_APPEND_LINK( &qnp->link, &qNameList ); | 163 PR_APPEND_LINK( &qnp->link, &qNameList ); |
164 } | 164 } |
165 | 165 |
166 /* Do we already have a matching RName? */ | 166 /* Do we already have a matching RName? */ |
167 if (!PR_CLIST_IS_EMPTY( &qnp->rNameList )) | 167 if (!PR_CLIST_IS_EMPTY( &qnp->rNameList )) |
168 { | 168 { |
169 rnp = (RName *) PR_LIST_HEAD( &qnp->rNameList ); | 169 rnp = (RName *) PR_LIST_HEAD( &qnp->rNameList ); |
170 do { | 170 do { |
171 /* | 171 /* |
172 ** No duplicate RNames are allowed within a QName | 172 ** No duplicate RNames are allowed within a QName |
173 ** | 173 ** |
174 */ | 174 */ |
175 PR_ASSERT( strcmp(rnp->name, rName)); | 175 PR_ASSERT( strcmp(rnp->name, rName)); |
176 rnp = (RName *)PR_NEXT_LINK( &rnp->link ); | 176 rnp = (RName *)PR_NEXT_LINK( &rnp->link ); |
177 } while( rnp != (RName *)PR_LIST_HEAD( &qnp->rNameList )); | 177 } while( rnp != (RName *)&qnp->rNameList ); |
178 } | 178 } |
179 | 179 |
180 /* Get a new RName structure; initialize its members */ | 180 /* Get a new RName structure; initialize its members */ |
181 rnp = PR_NEWZAP( RName ); | 181 rnp = PR_NEWZAP( RName ); |
182 PR_ASSERT( rnp != NULL ); | 182 PR_ASSERT( rnp != NULL ); |
183 PR_INIT_CLIST( &rnp->link ); | 183 PR_INIT_CLIST( &rnp->link ); |
184 strcpy( rnp->name, rName ); | 184 strcpy( rnp->name, rName ); |
185 strcpy( rnp->desc, description ); | 185 strcpy( rnp->desc, description ); |
186 rnp->lock = PR_NewLock(); | 186 rnp->lock = PR_NewLock(); |
187 if ( rnp->lock == NULL ) | 187 if ( rnp->lock == NULL ) |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 else if ( PR_NEXT_LINK( &rnp->link ) == &qnp->rNameList ) | 465 else if ( PR_NEXT_LINK( &rnp->link ) == &qnp->rNameList ) |
466 rnp = NULL; | 466 rnp = NULL; |
467 else | 467 else |
468 rnp = (RName *)PR_NEXT_LINK( &rnp->link ); | 468 rnp = (RName *)PR_NEXT_LINK( &rnp->link ); |
469 | 469 |
470 PR_LOG( lm, PR_LOG_DEBUG, ("PR_Counter: FindNextRname: Rhandle: %p, QHandle:
%p, Returns: %p", | 470 PR_LOG( lm, PR_LOG_DEBUG, ("PR_Counter: FindNextRname: Rhandle: %p, QHandle:
%p, Returns: %p", |
471 rhandle, qhandle, rnp )); | 471 rhandle, qhandle, rnp )); |
472 | 472 |
473 return((PRCounterHandle)rnp); | 473 return((PRCounterHandle)rnp); |
474 } /* end PR_FindNextCounterRname() */ | 474 } /* end PR_FindNextCounterRname() */ |
OLD | NEW |