mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Add strndup.h header so we can use this useful function
It's missing on Windows... we had this helper in liquivision.c but since I used the function in git-access.c I figured I should just turn it into a little helper. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
5bbcc7f16d
commit
e84d8624bb
4 changed files with 25 additions and 19 deletions
|
@ -10,6 +10,7 @@
|
|||
#include "dive.h"
|
||||
#include "device.h"
|
||||
#include "membuffer.h"
|
||||
#include "strndup.h"
|
||||
|
||||
/*
|
||||
* We're outputting utf8 in xml.
|
||||
|
@ -45,9 +46,7 @@ static void show_utf8(struct membuffer *b, const char *text, const char *pre, co
|
|||
return;
|
||||
while (len && isascii(text[len - 1]) && isspace(text[len - 1]))
|
||||
len--;
|
||||
/* strndup would be easier, but that doesn't appear to exist on Windows / Mac */
|
||||
cleaned = strdup(text);
|
||||
cleaned[len] = '\0';
|
||||
cleaned = strndup(text, len);
|
||||
put_string(b, pre);
|
||||
quote(b, cleaned, is_attribute);
|
||||
put_string(b, post);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue