version 1.10, 2017/06/12 19:05:47 |
version 1.12, 2022/04/14 16:43:44 |
|
|
/* $Id$ */ |
/* $Id$ */ |
/* |
/* |
|
* Copyright (c) 2014, 2015, 2017, 2018 Ingo Schwarze <schwarze@openbsd.org> |
* Copyright (c) 2009, 2011 Kristaps Dzonsons <kristaps@bsd.lv> |
* Copyright (c) 2009, 2011 Kristaps Dzonsons <kristaps@bsd.lv> |
* Copyright (c) 2014, 2015, 2017 Ingo Schwarze <schwarze@openbsd.org> |
|
* |
* |
* Permission to use, copy, modify, and distribute this software for any |
* Permission to use, copy, modify, and distribute this software for any |
* purpose with or without fee is hereby granted, provided that the above |
* purpose with or without fee is hereby granted, provided that the above |
|
|
#include <stdio.h> |
#include <stdio.h> |
#include <string.h> |
#include <string.h> |
|
|
|
#define DEBUG_NODEF 1 |
#include "mandoc.h" |
#include "mandoc.h" |
#include "mandoc_aux.h" |
#include "mandoc_aux.h" |
|
|
Line 111 mandoc_strndup(const char *ptr, size_t sz) |
|
Line 112 mandoc_strndup(const char *ptr, size_t sz) |
|
{ |
{ |
char *p; |
char *p; |
|
|
p = mandoc_malloc(sz + 1); |
p = strndup(ptr, sz); |
memcpy(p, ptr, sz); |
if (p == NULL) |
p[(int)sz] = '\0'; |
err((int)MANDOCLEVEL_SYSERR, NULL); |
return p; |
return p; |
} |
} |