Compare commits

..

6 Commits

Author SHA1 Message Date
787611dbd4 autotools configure updates; 2025-03-10 23:54:00 +02:00
a5fdc8e119 gitignore update for debian dir; 2025-03-06 01:10:27 +02:00
fecbd1286c Debian files fixed, package version bump-up; 2025-03-05 14:42:55 +02:00
Alexander Vdolainen
9de915d72f merge with 1.3.3; 2019-11-12 14:20:38 +02:00
Alexander Vdolainen
e78adae9d6 snadd() function; 2019-11-12 14:18:27 +02:00
Alexander Vdolainen
f5c0db55ac minor comments; 2019-11-12 14:17:16 +02:00
6 changed files with 61 additions and 28 deletions

View File

@ -1,6 +1,6 @@
dnl Process this file with autoconf to produce a configure script. dnl Process this file with autoconf to produce a configure script.
AC_INIT(libsexpr, m4_esyscmd([tr -d '\n' < VERSION])) AC_INIT([libsexpr],[m4_esyscmd(tr -d '\n' < VERSION)])
AC_CONFIG_HEADERS([config.h]) AC_CONFIG_HEADERS([config.h])
@ -30,8 +30,9 @@ AS_IF([test "x$enable_faststack_alloc" = "xyes"], [
AC_DEFINE([USE_FASTSTACK_ALLOC], 1, [using faststack allocation within parser]) AC_DEFINE([USE_FASTSTACK_ALLOC], 1, [using faststack allocation within parser])
]) ])
AC_OUTPUT([ AC_CONFIG_FILES([
Makefile Makefile
lib/libsexpr.pc lib/libsexpr.pc
lib/Makefile lib/Makefile
include/Makefile]) include/Makefile])
AC_OUTPUT

1
debian/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.debhelper

7
debian/changelog vendored
View File

@ -1,3 +1,10 @@
libsexpr (1.3.3) stable; urgency=medium
* Release 1.3.3 More helper functions to easy works on a simple S expressions
* Updates to the new and uptodate libraries
-- Alexander Vdolainen <alex@vapaa.xyz> Mon, 3 Jun 2019 23:34:56 +0100
libsexpr (1.3.1) stable; urgency=medium libsexpr (1.3.1) stable; urgency=medium
* Release 1.3.1 Added helper functions to operate with S-expressions * Release 1.3.1 Added helper functions to operate with S-expressions

35
debian/copyright vendored
View File

@ -1,20 +1,26 @@
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: libsexpr Upstream-Name: libsexpr
Source: <url://example.com> Source: <https://vapaa.work/public/libsexpr>
Files: * Files: *
Copyright: <years> <put author's name and email here> Copyright: 2003 - 2006 Matthew Sottile <mjsottile@gmail.com>
<years> <likewise for another author> 2010 - 2014 Alexander Vdolainen <alex@vapaa.xyz>
License: <special license> License: LGPL-2
<Put the license of the package here indented by 1 space> Additionally, this library is free software; you can redistribute it and/or
<This follows the format of Description: lines in control file> modify it under the terms of the GNU Lesser General Public License as
. published by the Free Software Foundation; either version 2.1 of the
<Including paragraphs> License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
for more details.
You should have received a copy of the GNU Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, U SA
# If you want to use GPL v2 or later for the /debian/* files use
# the following clauses, or change it to suit. Delete these two lines
Files: debian/* Files: debian/*
Copyright: 2014 Alexander Vdolainen <vdo@daze> Copyright: 2014, 2025 Alexander Vdolainen <alex@vapaa.xyz>
License: GPL-2+ License: GPL-2+
This package is free software; you can redistribute it and/or modify This package is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -31,8 +37,3 @@ License: GPL-2+
. .
On Debian systems, the complete text of the GNU General On Debian systems, the complete text of the GNU General
Public License version 2 can be found in "/usr/share/common-licenses/GPL-2". Public License version 2 can be found in "/usr/share/common-licenses/GPL-2".
# Please also look if there are files or directories which have a
# different copyright/license attached and list them here.
# Please avoid to pick license terms that are more restrictive than the
# packaged work, as it may make Debian's contributions unacceptable upstream.

View File

@ -97,6 +97,17 @@ extern "C" {
*/ */
CSTRING *sadd(CSTRING *s, char *a); CSTRING *sadd(CSTRING *s, char *a);
/**
* Concatenate the len bytes of the second argument to the CSTRING
* passed in the first.
* A NULL return value indicates that something went wrong and that
* sexp_errno should be checked for the cause. The contents of s are
* left alone. As such, the caller should check the pointer returned
* before overwriting the value of s, as this may result in a memory
* leak if an error condition occurs.
*/
CSTRING *snadd(CSTRING *s, char *a, size_t len);
/** /**
* Append a character to the end of the CSTRING. * Append a character to the end of the CSTRING.
* A NULL return value indicates that something went wrong and that * A NULL return value indicates that something went wrong and that

View File

@ -86,7 +86,18 @@ CSTRING *snew(size_t s) {
return cs; return cs;
} }
CSTRING *sadd(CSTRING *s, char *a) { CSTRING *sadd(CSTRING *s, char *a)
{
size_t len = strlen(a);
if(!s) return NULL;
if(!a || !len) return s;
return snadd(s, a, len);
}
CSTRING *snadd(CSTRING *s, char *a, size_t len)
{
size_t alen; size_t alen;
char *newbase; char *newbase;
@ -100,7 +111,7 @@ CSTRING *sadd(CSTRING *s, char *a) {
return s; return s;
} }
alen = strlen(a); alen = len;
if (s->curlen + alen >= s->len) { if (s->curlen + alen >= s->len) {
#ifdef __cplusplus #ifdef __cplusplus
@ -125,9 +136,10 @@ CSTRING *sadd(CSTRING *s, char *a) {
s->base = newbase; s->base = newbase;
} }
memcpy(&s->base[s->curlen],a,alen); memcpy(&s->base[s->curlen], a, alen);
s->curlen += alen; s->curlen += alen;
s->base[s->curlen] = 0; s->base[s->curlen] = 0;
return s; return s;
} }