Ian Jauslin
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/istring.h')
-rw-r--r--src/istring.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/istring.h b/src/istring.h
new file mode 100644
index 0000000..5b47b9b
--- /dev/null
+++ b/src/istring.h
@@ -0,0 +1,40 @@
+/*
+Copyright 2015 Ian Jauslin
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+/*
+String manipulation
+*/
+
+#ifndef ISTRING_H
+#define ISTRING_H
+
+// concatenate str at the position pointed to by ptr, and return a pointer
+// to the end of the new string
+char* str_concat(char* ptr, const char* str);
+// concatenate strings and resize them if necessary
+int str_concat_memorysafe(char** str_out, int pos, const char* str, int* memory);
+// resize a string
+int resize_str(char** out, int memory);
+// idem with a single character
+char* str_addchar(char* ptr, const char c);
+// string length
+int str_len(char* str);
+// compare strings
+int str_cmp(char* str1, char* str2);
+// copy a string to another without allocating memory
+int str_cpy_noalloc(char* input, char* output);
+
+#endif