Description: Use unsigned long for rl_readline_state with readline 7.0
Author: Dimitri John Ledkov <xnox@ubuntu.com>
Bug-Debian: https://bugs.debian.org/840689
Bug-Upstream: https://rt.cpan.org/Public/Bug/Display.html?id=118371

--- a/Gnu.xs
+++ b/Gnu.xs
@@ -501,59 +501,64 @@
   int *var;
   int charp;
   int read_only;
+  int ulong;
 } int_tbl[] = {
-  { &rl_point,					0, 0 },	/* 0 */
-  { &rl_end,					0, 0 },	/* 1 */
-  { &rl_mark,					0, 0 },	/* 2 */
-  { &rl_done,					0, 0 },	/* 3 */
-  { &rl_pending_input,				0, 0 },	/* 4 */
-
-  { &rl_completion_query_items,			0, 0 },	/* 5 */
-  { &rl_completion_append_character,		0, 0 },	/* 6 */
-  { &rl_ignore_completion_duplicates,		0, 0 },	/* 7 */
-  { &rl_filename_completion_desired,		0, 0 },	/* 8 */
-  { &rl_filename_quoting_desired,		0, 0 },	/* 9 */
-  { &rl_inhibit_completion,			0, 0 },	/* 10 */
+  { &rl_point,					0, 0, 0},	/* 0 */
+  { &rl_end,					0, 0, 0},	/* 1 */
+  { &rl_mark,					0, 0, 0},	/* 2 */
+  { &rl_done,					0, 0, 0},	/* 3 */
+  { &rl_pending_input,				0, 0, 0},	/* 4 */
+
+  { &rl_completion_query_items,			0, 0, 0},	/* 5 */
+  { &rl_completion_append_character,		0, 0, 0},	/* 6 */
+  { &rl_ignore_completion_duplicates,		0, 0, 0},	/* 7 */
+  { &rl_filename_completion_desired,		0, 0, 0},	/* 8 */
+  { &rl_filename_quoting_desired,		0, 0, 0},	/* 9 */
+  { &rl_inhibit_completion,			0, 0, 0},	/* 10 */
 
-  { &history_base,				0, 0 },	/* 11 */
-  { &history_length,				0, 0 },	/* 12 */
+  { &history_base,				0, 0, 0},	/* 11 */
+  { &history_length,				0, 0, 0},	/* 12 */
 #if (RL_READLINE_VERSION >= 0x0402)
-  { &history_max_entries,			0, 1 },	/* 13 */
+  { &history_max_entries,			0, 1, 0},	/* 13 */
 #else /* (RL_READLINE_VERSION < 0x0402) */
-  { &max_input_history,				0, 1 },	/* 13 */
+  { &max_input_history,				0, 1, 0},	/* 13 */
 #endif /* (RL_READLINE_VERSION < 0x0402) */
-  { &history_write_timestamps,			0, 0 },	/* 14 */
-  { (int *)&history_expansion_char,		1, 0 },	/* 15 */
-  { (int *)&history_subst_char,			1, 0 },	/* 16 */
-  { (int *)&history_comment_char,		1, 0 },	/* 17 */
-  { &history_quotes_inhibit_expansion,		0, 0 },	/* 18 */
-  { &rl_erase_empty_line,			0, 0 },	/* 19 */
-  { &rl_catch_signals,				0, 0 },	/* 20 */
-  { &rl_catch_sigwinch,				0, 0 },	/* 21 */
-  { &rl_already_prompted,			0, 0 },	/* 22 */
-  { &rl_num_chars_to_read,			0, 0 },	/* 23 */
-  { &rl_dispatching,				0, 0 },	/* 24 */
-  { &rl_gnu_readline_p,				0, 1 },	/* 25 */
-  /* rl_readline_state becomes unsigned long on RL 7.0 */
-  { (int *)&rl_readline_state,			0, 0 },	/* 26 */
-  { &rl_explicit_arg,				0, 1 },	/* 27 */
-  { &rl_numeric_arg,				0, 1 },	/* 28 */
-  { &rl_editing_mode,				0, 1 },	/* 29 */
-  { &rl_attempted_completion_over,		0, 0 },	/* 30 */
-  { &rl_completion_type,			0, 0 },	/* 31 */
-  { &rl_readline_version,			0, 1 },	/* 32 */
-  { &rl_completion_suppress_append,		0, 0 },	/* 33 */
-  { &rl_completion_quote_character,		0, 1 },	/* 34 */
-  { &rl_completion_suppress_quote,		0, 0 },	/* 35 */
-  { &rl_completion_found_quote,			0, 1 },	/* 36 */
-  { &rl_completion_mark_symlink_dirs,		0, 0 },	/* 37 */
-  { &rl_prefer_env_winsize,			0, 0 },	/* 38 */
-  { &rl_sort_completion_matches,		0, 0 },	/* 39 */
-  { &rl_completion_invoking_key,		0, 1 },	/* 40 */
-  { &rl_executing_key,				0, 1 },	/* 41 */
-  { &rl_key_sequence_length,			0, 1 },	/* 42 */
-  { &rl_change_environment,			0, 0 },	/* 43 */
-  { &utf8_mode,					0, 0 }	/* 44 */
+  { &history_write_timestamps,			0, 0, 0},	/* 14 */
+  { (int *)&history_expansion_char,		1, 0, 0},	/* 15 */
+  { (int *)&history_subst_char,			1, 0, 0},	/* 16 */
+  { (int *)&history_comment_char,		1, 0, 0},	/* 17 */
+  { &history_quotes_inhibit_expansion,		0, 0, 0},	/* 18 */
+  { &rl_erase_empty_line,			0, 0, 0},	/* 19 */
+  { &rl_catch_signals,				0, 0, 0},	/* 20 */
+  { &rl_catch_sigwinch,				0, 0, 0},	/* 21 */
+  { &rl_already_prompted,			0, 0, 0},	/* 22 */
+  { &rl_num_chars_to_read,			0, 0, 0},	/* 23 */
+  { &rl_dispatching,				0, 0, 0},	/* 24 */
+  { &rl_gnu_readline_p,				0, 1, 0},	/* 25 */
+/* rl_readline_state becomes unsigned long on RL 7.0 */
+#if (RL_READLINE_VERSION >= 0x0700)
+  { (unsigned long *)&rl_readline_state,	0, 0, 1},	/* 26 */
+#else
+  { (int *)&rl_readline_state,			0, 0, 0},	/* 26 */
+#endif
+  { &rl_explicit_arg,				0, 1, 0},	/* 27 */
+  { &rl_numeric_arg,				0, 1, 0},	/* 28 */
+  { &rl_editing_mode,				0, 1, 0},	/* 29 */
+  { &rl_attempted_completion_over,		0, 0, 0},	/* 30 */
+  { &rl_completion_type,			0, 0, 0},	/* 31 */
+  { &rl_readline_version,			0, 1, 0},	/* 32 */
+  { &rl_completion_suppress_append,		0, 0, 0},	/* 33 */
+  { &rl_completion_quote_character,		0, 1, 0},	/* 34 */
+  { &rl_completion_suppress_quote,		0, 0, 0},	/* 35 */
+  { &rl_completion_found_quote,			0, 1, 0},	/* 36 */
+  { &rl_completion_mark_symlink_dirs,		0, 0, 0},	/* 37 */
+  { &rl_prefer_env_winsize,			0, 0, 0},	/* 38 */
+  { &rl_sort_completion_matches,		0, 0, 0},	/* 39 */
+  { &rl_completion_invoking_key,		0, 1, 0},	/* 40 */
+  { &rl_executing_key,				0, 1, 0},	/* 41 */
+  { &rl_key_sequence_length,			0, 1, 0},	/* 42 */
+  { &rl_change_environment,			0, 0, 0},	/* 43 */
+  { &utf8_mode,					0, 0, 0}	/* 44 */
 };
 
 /*
@@ -3198,6 +3203,8 @@
 	  /* set C variable */
 	  if (int_tbl[id].charp)
 	    *((char *)(int_tbl[id].var)) = (char)pint;
+	  else if (int_tbl[id].ulong)
+	    *((unsigned long *)(int_tbl[id].var)) = (unsigned long)pint;
 	  else
 	    *(int_tbl[id].var) = pint;
 
@@ -3216,9 +3223,15 @@
 	    warn("Gnu.xs:_rl_fetch_int: Illegal `id' value: `%d'", id);
 	    /* return undef */
 	  } else {
-	    sv_setiv(ST(0),
-		     int_tbl[id].charp ? (int)*((char *)(int_tbl[id].var))
-		     : *(int_tbl[id].var));
+	      if (int_tbl[id].charp)
+		  sv_setiv(ST(0),
+			   (int)*((char *)(int_tbl[id].var)));
+	      else if (int_tbl[id].ulong)
+		  sv_setiv(ST(0),
+			   (int)*((unsigned long *)(int_tbl[id].var)));
+	      else
+		  sv_setiv(ST(0),
+			   *(int_tbl[id].var));
 	  }
 	}
 
