unvis.c (8dfeba04eb36ced9343a0a924e18160d46b1fbca) unvis.c (ea46e63863df9bd36b65f7293092214f1937349e)
1/* $NetBSD: unvis.c,v 1.44 2014/09/26 15:43:36 roy Exp $ */
1/* $NetBSD: unvis.c,v 1.45 2022/04/19 20:32:15 rillig Exp $ */
2
3/*-
4 * Copyright (c) 1989, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:

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

29 * SUCH DAMAGE.
30 */
31
32#include <sys/cdefs.h>
33#if defined(LIBC_SCCS) && !defined(lint)
34#if 0
35static char sccsid[] = "@(#)unvis.c 8.1 (Berkeley) 6/4/93";
36#else
2
3/*-
4 * Copyright (c) 1989, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:

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

29 * SUCH DAMAGE.
30 */
31
32#include <sys/cdefs.h>
33#if defined(LIBC_SCCS) && !defined(lint)
34#if 0
35static char sccsid[] = "@(#)unvis.c 8.1 (Berkeley) 6/4/93";
36#else
37__RCSID("$NetBSD: unvis.c,v 1.44 2014/09/26 15:43:36 roy Exp $");
37__RCSID("$NetBSD: unvis.c,v 1.45 2022/04/19 20:32:15 rillig Exp $");
38#endif
39#endif /* LIBC_SCCS and not lint */
40__FBSDID("$FreeBSD$");
41
42#include "namespace.h"
43#include <sys/types.h>
44
45#include <assert.h>

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

509 _DIAGASSERT(src != NULL);
510 _DIAGASSERT(dst != NULL);
511#define CHECKSPACE() \
512 do { \
513 if (dlen-- == 0) { \
514 errno = ENOSPC; \
515 return -1; \
516 } \
38#endif
39#endif /* LIBC_SCCS and not lint */
40__FBSDID("$FreeBSD$");
41
42#include "namespace.h"
43#include <sys/types.h>
44
45#include <assert.h>

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

509 _DIAGASSERT(src != NULL);
510 _DIAGASSERT(dst != NULL);
511#define CHECKSPACE() \
512 do { \
513 if (dlen-- == 0) { \
514 errno = ENOSPC; \
515 return -1; \
516 } \
517 } while (/*CONSTCOND*/0)
517 } while (0)
518
519 while ((c = *src++) != '\0') {
520 again:
521 switch (unvis(&t, c, &state, flag)) {
522 case UNVIS_VALID:
523 CHECKSPACE();
524 *dst++ = t;
525 break;

--- 43 unchanged lines hidden ---
518
519 while ((c = *src++) != '\0') {
520 again:
521 switch (unvis(&t, c, &state, flag)) {
522 case UNVIS_VALID:
523 CHECKSPACE();
524 *dst++ = t;
525 break;

--- 43 unchanged lines hidden ---