pspp-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[pre-lexer-2 2/4] str: Inline some trivial functions.


From: Ben Pfaff
Subject: [pre-lexer-2 2/4] str: Inline some trivial functions.
Date: Fri, 24 Sep 2010 21:17:52 -0700

---
 src/libpspp/str.c |   29 -----------------------------
 src/libpspp/str.h |   37 +++++++++++++++++++++++++++++++++----
 2 files changed, 33 insertions(+), 33 deletions(-)

diff --git a/src/libpspp/str.c b/src/libpspp/str.c
index 9f0cb6e..d4790e7 100644
--- a/src/libpspp/str.c
+++ b/src/libpspp/str.c
@@ -321,35 +321,6 @@ mempset (void *block, int c, size_t size)
 
 /* Substrings. */
 
-/* Returns an empty substring. */
-struct substring
-ss_empty (void)
-{
-  struct substring ss;
-  ss.string = NULL;
-  ss.length = 0;
-  return ss;
-}
-
-/* Returns a substring whose contents are the given C-style
-   string CSTR. */
-struct substring
-ss_cstr (const char *cstr)
-{
-  return ss_buffer (cstr, strlen (cstr));
-}
-
-/* Returns a substring whose contents are the CNT characters in
-   BUFFER. */
-struct substring
-ss_buffer (const char *buffer, size_t cnt)
-{
-  struct substring ss;
-  ss.string = (char *) buffer;
-  ss.length = cnt;
-  return ss;
-}
-
 /* Returns a substring whose contents are the CNT characters
    starting at the (0-based) position START in SS. */
 struct substring
diff --git a/src/libpspp/str.h b/src/libpspp/str.h
index 0b57f73..b821a59 100644
--- a/src/libpspp/str.h
+++ b/src/libpspp/str.h
@@ -1,5 +1,5 @@
 /* PSPP - a program for statistical analysis.
-   Copyright (C) 1997-9, 2000, 2009 Free Software Foundation, Inc.
+   Copyright (C) 1997-9, 2000, 2009, 2010 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -75,9 +75,9 @@ struct substring
 /* Constructors.
    These functions do not allocate any memory, so the substrings
    they create should not normally be destroyed. */
-struct substring ss_empty (void);
-struct substring ss_cstr (const char *);
-struct substring ss_buffer (const char *, size_t);
+static inline struct substring ss_empty (void);
+static inline struct substring ss_cstr (const char *);
+static inline struct substring ss_buffer (const char *, size_t);
 struct substring ss_substr (struct substring, size_t start, size_t);
 struct substring ss_head (struct substring, size_t);
 struct substring ss_tail (struct substring, size_t);
@@ -229,6 +229,35 @@ void ds_relocate (struct string *st);
 void u8_buf_copy_rpad (uint8_t *dst, size_t dst_size,
                       const uint8_t *src, size_t src_size,
                       char pad);
+
+struct substring
+ss_empty (void)
+{
+  struct substring ss;
+  ss.string = NULL;
+  ss.length = 0;
+  return ss;
+}
+
+/* Returns a substring whose contents are the given C-style
+   string CSTR. */
+static inline struct substring
+ss_cstr (const char *cstr)
+{
+  return ss_buffer (cstr, strlen (cstr));
+}
+
+/* Returns a substring whose contents are the CNT characters in
+   BUFFER. */
+static inline struct substring
+ss_buffer (const char *buffer, size_t cnt)
+{
+  struct substring ss;
+  ss.string = (char *) buffer;
+  ss.length = cnt;
+  return ss;
+}
+
 
 
 #endif /* str_h */
-- 
1.7.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]