From 7abd89f9b3d15dd2da4015c440c0be7ec45fa700 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?=
 <grubba@grubba.org>
Date: Thu, 30 Dec 2004 13:57:24 +0100
Subject: [PATCH] Added add_pike_string_constant().

Rev: src/constants.c:1.55
Rev: src/constants.h:1.33
---
 src/constants.c | 11 ++++++++++-
 src/constants.h |  3 ++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/constants.c b/src/constants.c
index 8982cc0732..ea212d760c 100644
--- a/src/constants.c
+++ b/src/constants.c
@@ -2,7 +2,7 @@
 || This file is part of Pike. For copyright information see COPYRIGHT.
 || Pike is distributed under GPL, LGPL and MPL. See the file COPYING
 || for more information.
-|| $Id: constants.c,v 1.54 2004/09/18 20:50:48 nilsson Exp $
+|| $Id: constants.c,v 1.55 2004/12/30 12:57:24 grubba Exp $
 */
 
 #include "global.h"
@@ -53,6 +53,15 @@ void low_add_constant(const char *name, struct svalue *fun)
   free_string(p);
 }
 
+void add_pike_string_constant(const char *name, const char *str, int len)
+{
+  struct pike_string *key = make_shared_string(name);
+  struct pike_string *val = make_shared_binary_string(str, len);
+  mapping_string_insert_string(builtin_constants, key, val);
+  free_string(val);
+  free_string(key);
+}
+
 PMOD_EXPORT void add_global_program(const char *name, struct program *p)
 {
   struct svalue s;
diff --git a/src/constants.h b/src/constants.h
index 1898661c33..bd8dd4c38b 100644
--- a/src/constants.h
+++ b/src/constants.h
@@ -2,7 +2,7 @@
 || This file is part of Pike. For copyright information see COPYRIGHT.
 || Pike is distributed under GPL, LGPL and MPL. See the file COPYING
 || for more information.
-|| $Id: constants.h,v 1.32 2003/08/20 16:31:44 mast Exp $
+|| $Id: constants.h,v 1.33 2004/12/30 12:57:24 grubba Exp $
 */
 
 #ifndef ADD_EFUN_H
@@ -48,6 +48,7 @@ extern struct callable *first_callable;
 PMOD_EXPORT struct mapping *get_builtin_constants(void);
 void low_add_efun(struct pike_string *name, struct svalue *fun);
 void low_add_constant(const char *name, struct svalue *fun);
+void add_pike_string_constant(const char *name, const char *str, int len);
 PMOD_EXPORT void add_global_program(const char *name, struct program *p);
 BLOCK_ALLOC_FILL_PAGES(callable,2)
 PMOD_EXPORT struct callable *low_make_callable(c_fun fun,
-- 
GitLab