You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tcl.apache.org by mx...@apache.org on 2021/10/25 16:49:07 UTC

[tcl-rivet] branch master updated: add macro MINSTRLEN, expand comments in TclWebapache.c

This is an automated email from the ASF dual-hosted git repository.

mxmanghi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tcl-rivet.git


The following commit(s) were added to refs/heads/master by this push:
     new 2af4380  add macro MINSTRLEN, expand comments in TclWebapache.c
2af4380 is described below

commit 2af43806f6ab3a1906887ad3ffc1224a3951220d
Author: Massimo Manghi <ma...@gmail.com>
AuthorDate: Mon Oct 25 11:17:23 2021 +0200

    add macro MINSTRLEN, expand comments in TclWebapache.c
---
 ChangeLog                              |  4 ++++
 src/mod_rivet_ng/TclWebapache.c        | 16 +++++++++-------
 src/mod_rivet_ng/mod_rivet_generator.c |  2 +-
 src/rivet.h                            |  1 +
 4 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index bf536f7..2a4beef 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2021-10-25 Massimo Manghi <mx...@apache.org>
+	* src/mod_rivet_ng/Tclwebapache.c: extended comments
+	* src/rivet.h: new macro MINSTRLEN
+
 2021-10-20 Massimo Manghi <mx...@apache.org>
 	* src/mod_rivet_ng/Tclwebapache.c: new environment variable handling. 
 	Command ::rivet::env doesn't necessarily trigger the whole enviroment load
diff --git a/src/mod_rivet_ng/TclWebapache.c b/src/mod_rivet_ng/TclWebapache.c
index d4ae276..4d009c9 100644
--- a/src/mod_rivet_ng/TclWebapache.c
+++ b/src/mod_rivet_ng/TclWebapache.c
@@ -42,9 +42,9 @@
 extern module rivet_module;
 extern mod_rivet_globals* module_globals;
 
-/* It's kind of an overkill, but we define macros for handling the
- * flags that control and reduce the overhead when loading the 
- * environment variables */
+/* It's kind of an overkill: we define macros for handling the
+ * flags that control the handling of the three environment variables
+ * classes (common, CGI and include variables). */
 
 #define ENV_COMMON_VARS_M    1
 #define ENV_CGI_VARS_M       2
@@ -119,11 +119,13 @@ TclWeb_InitRequest(rivet_thread_private* private, Tcl_Interp *interp)
 
     /*
      * if strlen(req->content_type) > strlen([RIVET|TCL]_FILE_CTYPE)
-     * a charset parameters might be there 
+     * a charset parameters might be in the configuration like
+     *
+     * AddType 'application/x-httpd-rivet;charset=utf-8' rvt
      */
 
     if (((private->ctype==RIVET_TEMPLATE) && (content_type_len > strlen(RIVET_TEMPLATE_CTYPE))) || \
-         ((private->ctype==RIVET_TCLFILE) && (content_type_len > strlen(RIVET_TCLFILE_CTYPE)))) {
+        ((private->ctype==RIVET_TCLFILE) && (content_type_len > strlen(RIVET_TCLFILE_CTYPE)))) {
         
         char* charset;
 
@@ -457,7 +459,7 @@ TclWeb_VarNumber(Tcl_Obj *result, int source, TclWebRequest *req)
 }
 
 /* These 2 array must be aligned and a one-to-one correspondence preserved 
- * The enum include_vars_idx must be terminated by 'inval_env_var'
+ * The enum include_vars_idx must be terminated by 'invalid_env_var'
  */
 
 static const char* include_env_vars[] =
@@ -620,7 +622,7 @@ TclWeb_InitEnvVars (rivet_thread_private* private)
 static char*
 TclWeb_GetEnvIncludeVar (rivet_thread_private* private,char* key)
 {
-    int    idx;
+    int idx;
 
     for (idx = 0;idx < invalid_env_var; idx++)
     {
diff --git a/src/mod_rivet_ng/mod_rivet_generator.c b/src/mod_rivet_ng/mod_rivet_generator.c
index 1d7d080..e153700 100644
--- a/src/mod_rivet_ng/mod_rivet_generator.c
+++ b/src/mod_rivet_ng/mod_rivet_generator.c
@@ -172,7 +172,7 @@ Rivet_SendContent(rivet_thread_private *private)
                 scripts = Rivet_RunningScripts (private->pool,scripts,newconfig);
 
                 apr_hash_set (interp_obj->per_dir_scripts,rdc->path,strlen(rdc->path),scripts);
-               
+
                 private->running = scripts;
             }
         }
diff --git a/src/rivet.h b/src/rivet.h
index 87a05c8..f8975de 100644
--- a/src/rivet.h
+++ b/src/rivet.h
@@ -33,6 +33,7 @@ typedef int rivet_req_ctype;
 #define TCL_STORAGE_CLASS DLLEXPORT
 #endif /* BUILD_rivet */
 
+#define MINSTRLEN(s1,s2) strlen(s1) < strlen(s2) ? strlen(s1) : strlen(s2)
 #define STREQU(s1,s2)  (s1[0] == s2[0] && strcmp(s1, s2) == 0)
 #define STRNEQU(s1,s2) (s1[0] == s2[0] && strncmp(s1, s2, strlen(s2)) == 0)
 #define RIVET_NS                "::rivet"

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tcl.apache.org
For additional commands, e-mail: commits-help@tcl.apache.org