dba.c (316420) | dba.c (322249) |
---|---|
1/* $Id: dba.c,v 1.9 2017/01/15 15:28:55 schwarze Exp $ */ | 1/* $Id: dba.c,v 1.10 2017/02/17 14:43:54 schwarze Exp $ */ |
2/* 3 * Copyright (c) 2016, 2017 Ingo Schwarze <schwarze@openbsd.org> 4 * 5 * Permission to use, copy, modify, and distribute this software for any 6 * purpose with or without fee is hereby granted, provided that the above 7 * copyright notice and this permission notice appear in all copies. 8 * 9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --- 300 unchanged lines hidden (view full) --- 310} 311 312static int 313compare_names(const void *vp1, const void *vp2) 314{ 315 const char *cp1, *cp2; 316 int diff; 317 | 2/* 3 * Copyright (c) 2016, 2017 Ingo Schwarze <schwarze@openbsd.org> 4 * 5 * Permission to use, copy, modify, and distribute this software for any 6 * purpose with or without fee is hereby granted, provided that the above 7 * copyright notice and this permission notice appear in all copies. 8 * 9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --- 300 unchanged lines hidden (view full) --- 310} 311 312static int 313compare_names(const void *vp1, const void *vp2) 314{ 315 const char *cp1, *cp2; 316 int diff; 317 |
318 cp1 = *(char **)vp1; 319 cp2 = *(char **)vp2; | 318 cp1 = *(const char * const *)vp1; 319 cp2 = *(const char * const *)vp2; |
320 return (diff = *cp2 - *cp1) ? diff : 321 strcasecmp(cp1 + 1, cp2 + 1); 322} 323 324static int 325compare_strings(const void *vp1, const void *vp2) 326{ 327 const char *cp1, *cp2; 328 | 320 return (diff = *cp2 - *cp1) ? diff : 321 strcasecmp(cp1 + 1, cp2 + 1); 322} 323 324static int 325compare_strings(const void *vp1, const void *vp2) 326{ 327 const char *cp1, *cp2; 328 |
329 cp1 = *(char **)vp1; 330 cp2 = *(char **)vp2; | 329 cp1 = *(const char * const *)vp1; 330 cp2 = *(const char * const *)vp2; |
331 return strcmp(cp1, cp2); 332} 333 334/*** functions for handling macros ************************************/ 335 336/* 337 * In the hash table for a single macro, look up an entry by 338 * the macro value or add an empty one if it doesn't exist yet. --- 158 unchanged lines hidden (view full) --- 497 free(dpos); 498} 499 500static int 501compare_entries(const void *vp1, const void *vp2) 502{ 503 const struct macro_entry *ep1, *ep2; 504 | 331 return strcmp(cp1, cp2); 332} 333 334/*** functions for handling macros ************************************/ 335 336/* 337 * In the hash table for a single macro, look up an entry by 338 * the macro value or add an empty one if it doesn't exist yet. --- 158 unchanged lines hidden (view full) --- 497 free(dpos); 498} 499 500static int 501compare_entries(const void *vp1, const void *vp2) 502{ 503 const struct macro_entry *ep1, *ep2; 504 |
505 ep1 = *(struct macro_entry **)vp1; 506 ep2 = *(struct macro_entry **)vp2; | 505 ep1 = *(const struct macro_entry * const *)vp1; 506 ep2 = *(const struct macro_entry * const *)vp2; |
507 return strcmp(ep1->value, ep2->value); 508} | 507 return strcmp(ep1->value, ep2->value); 508} |