nxt_string.c (355:9327d0acece7) nxt_string.c (362:cb602eff2e49)
1
2/*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) NGINX, Inc.
5 */
6
7#include <nxt_main.h>
8

--- 402 unchanged lines hidden (view full) ---

411}
412
413
414nxt_bool_t
415nxt_strvers_match(u_char *version, u_char *prefix, size_t length)
416{
417 u_char next, last;
418
1
2/*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) NGINX, Inc.
5 */
6
7#include <nxt_main.h>
8

--- 402 unchanged lines hidden (view full) ---

411}
412
413
414nxt_bool_t
415nxt_strvers_match(u_char *version, u_char *prefix, size_t length)
416{
417 u_char next, last;
418
419 if (length == 0) {
420 return 1;
421 }
422
419 if (nxt_strncmp(version, prefix, length) == 0) {
420
421 next = version[length];
422
423 if (next == '\0') {
424 return 1;
425 }
426
427 last = version[length - 1];
428
429 if (nxt_isdigit(last) != nxt_isdigit(next)) {
430 /* This is a version part boundary. */
431 return 1;
432 }
433 }
434
435 return 0;
436}
423 if (nxt_strncmp(version, prefix, length) == 0) {
424
425 next = version[length];
426
427 if (next == '\0') {
428 return 1;
429 }
430
431 last = version[length - 1];
432
433 if (nxt_isdigit(last) != nxt_isdigit(next)) {
434 /* This is a version part boundary. */
435 return 1;
436 }
437 }
438
439 return 0;
440}