diff --git a/src/builtin_functions.c b/src/builtin_functions.c
index da59a5a38f07ce3e07f288f8abcc7911f462f54b..f69d060cc16a14e0db65b9b05e5e92918dc297d8 100644
--- a/src/builtin_functions.c
+++ b/src/builtin_functions.c
@@ -4919,7 +4919,6 @@ PMOD_EXPORT void f_sleep(INT32 args)
 }
 
 #undef FIX_LEFT
-#undef GET_TIME_ELAPSED
 #undef TIME_ELAPSED
 
 /*! @decl void delay(int|float s)
diff --git a/src/encode.c b/src/encode.c
index 99cb9b4c6056ae641f07b30fb8b962976f1ade11..d61fee34681459095a641db9087a0d67cc0b379d 100644
--- a/src/encode.c
+++ b/src/encode.c
@@ -225,16 +225,6 @@ static void encode_value2(struct svalue *val, struct encode_data *data, int forc
   }							\
 }while(0)
 
-/* Like adddata, but allows null pointers */
-
-#define adddata3(S) do {			\
-  if(S) {					\
-    adddata(S);                                 \
-  } else {					\
-    code_entry(TAG_INT, 0, data);			\
-  }						\
-}while(0)
-
 #define adddata2(s,l) addstr((char *)(s),(l) * sizeof((s)[0]));
 
 #ifdef ENCODE_DEBUG
@@ -2095,13 +2085,6 @@ static DECLSPEC(noreturn) void decode_error (
     (Y)=num;								\
   } while(0);
 
-#define getdata2(S,L) do {						\
-      if(sizeof(S[0])*(L) > (size_t)(data->len - data->ptr))		\
-	decode_error(data, NULL, "String range error.\n");		\
-      MEMCPY((S),(data->data + data->ptr), sizeof(S[0])*(L));		\
-      data->ptr+=sizeof(S[0])*(L);					\
-  }while(0)
-
 #if PIKE_BYTEORDER == 4321
 #define BITFLIP(S)
 #else
diff --git a/src/error.c b/src/error.c
index 3561107ca600f124241cd1c9901215a8b028f6c6..6bd8a39043c591e1000e98e35735910717d85ccd 100644
--- a/src/error.c
+++ b/src/error.c
@@ -882,10 +882,6 @@ static void f_error_create(INT32 args)
   } while (0)
 
 
-#define ERROR_COPY_REF(STRUCT,X) \
-  add_ref( ERROR_STRUCT(STRUCT,o)->X=X )
-
-
 /* This prepares the passed object o, which is assumed to inherit
  * generic_error_program, and throws it:
  *