Replace vim_strncpy calls: add STRLCPY

This commit is contained in:
Douglas Schneider
2014-05-26 10:16:25 -06:00
committed by Justin M. Keyes
parent 5b3b3fd3ed
commit f9596aa201
2 changed files with 2 additions and 1 deletions

View File

@@ -1,6 +1,5 @@
// Various routines dealing with allocation and deallocation of memory. // Various routines dealing with allocation and deallocation of memory.
#include <stdlib.h>
#include <string.h> #include <string.h>
#include "nvim/vim.h" #include "nvim/vim.h"

View File

@@ -8,6 +8,7 @@
#ifndef NVIM_VIM_H #ifndef NVIM_VIM_H
# define NVIM_VIM_H # define NVIM_VIM_H
#include "nvim/memory.h"// for xstrlcpy
#include "nvim/types.h" #include "nvim/types.h"
/* Included when ported to cmake */ /* Included when ported to cmake */
@@ -834,6 +835,7 @@ typedef enum {
#define STRLEN(s) strlen((char *)(s)) #define STRLEN(s) strlen((char *)(s))
#define STRCPY(d, s) strcpy((char *)(d), (char *)(s)) #define STRCPY(d, s) strcpy((char *)(d), (char *)(s))
#define STRNCPY(d, s, n) strncpy((char *)(d), (char *)(s), (size_t)(n)) #define STRNCPY(d, s, n) strncpy((char *)(d), (char *)(s), (size_t)(n))
#define STRLCPY(d, s, n) xstrlcpy((char *)(d), (char *)(s), (size_t)(n))
#define STRCMP(d, s) strcmp((char *)(d), (char *)(s)) #define STRCMP(d, s) strcmp((char *)(d), (char *)(s))
#define STRNCMP(d, s, n) strncmp((char *)(d), (char *)(s), (size_t)(n)) #define STRNCMP(d, s, n) strncmp((char *)(d), (char *)(s), (size_t)(n))
#ifdef HAVE_STRCASECMP #ifdef HAVE_STRCASECMP