| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: dewey.c,v 1.8 2007/09/27 13:30:28 joerg Exp $ */ | | 1 | /* $NetBSD: dewey.c,v 1.9 2008/12/14 10:18:16 rillig Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright © 2002 Alistair G. Crooks. All rights reserved. | | 4 | * Copyright © 2002 Alistair G. Crooks. All rights reserved. |
5 | * | | 5 | * |
6 | * Redistribution and use in source and binary forms, with or without | | 6 | * Redistribution and use in source and binary forms, with or without |
7 | * modification, are permitted provided that the following conditions | | 7 | * modification, are permitted provided that the following conditions |
8 | * are met: | | 8 | * are met: |
9 | * 1. Redistributions of source code must retain the above copyright | | 9 | * 1. Redistributions of source code must retain the above copyright |
10 | * notice, this list of conditions and the following disclaimer. | | 10 | * notice, this list of conditions and the following disclaimer. |
11 | * 2. Redistributions in binary form must reproduce the above copyright | | 11 | * 2. Redistributions in binary form must reproduce the above copyright |
12 | * notice, this list of conditions and the following disclaimer in the | | 12 | * notice, this list of conditions and the following disclaimer in the |
13 | * documentation and/or other materials provided with the distribution. | | 13 | * documentation and/or other materials provided with the distribution. |
14 | * 3. The name of the author may not be used to endorse or promote | | 14 | * 3. The name of the author may not be used to endorse or promote |
| @@ -163,27 +163,27 @@ mkcomponent(arr_t *ap, const char *num) | | | @@ -163,27 +163,27 @@ mkcomponent(arr_t *ap, const char *num) |
163 | ap->v[ap->c++] = Dot; | | 163 | ap->v[ap->c++] = Dot; |
164 | cp = strchr(alphas, tolower((unsigned char)*num)); | | 164 | cp = strchr(alphas, tolower((unsigned char)*num)); |
165 | if (ap->c == ap->size) { | | 165 | if (ap->c == ap->size) { |
166 | ap->size *= 2; | | 166 | ap->size *= 2; |
167 | if ((ap->v = realloc(ap->v, ap->size * sizeof(int))) == NULL) | | 167 | if ((ap->v = realloc(ap->v, ap->size * sizeof(int))) == NULL) |
168 | err(EXIT_FAILURE, "mkver realloc failed"); | | 168 | err(EXIT_FAILURE, "mkver realloc failed"); |
169 | } | | 169 | } |
170 | ap->v[ap->c++] = (int)(cp - alphas) + 1; | | 170 | ap->v[ap->c++] = (int)(cp - alphas) + 1; |
171 | return 1; | | 171 | return 1; |
172 | } | | 172 | } |
173 | return 1; | | 173 | return 1; |
174 | } | | 174 | } |
175 | | | 175 | |
176 | /* make a version number string into an array of comparable 64bit ints */ | | 176 | /* make a version number string into an array of comparable ints */ |
177 | static int | | 177 | static int |
178 | mkversion(arr_t *ap, const char *num) | | 178 | mkversion(arr_t *ap, const char *num) |
179 | { | | 179 | { |
180 | ap->c = 0; | | 180 | ap->c = 0; |
181 | ap->size = 0; | | 181 | ap->size = 0; |
182 | ap->v = NULL; | | 182 | ap->v = NULL; |
183 | ap->netbsd = 0; | | 183 | ap->netbsd = 0; |
184 | | | 184 | |
185 | while (*num) { | | 185 | while (*num) { |
186 | num += mkcomponent(ap, num); | | 186 | num += mkcomponent(ap, num); |
187 | } | | 187 | } |
188 | return 1; | | 188 | return 1; |
189 | } | | 189 | } |