File tree Expand file tree Collapse file tree 2 files changed +3
-8
lines changed Expand file tree Collapse file tree 2 files changed +3
-8
lines changed Original file line number Diff line number Diff line change 1+ clang-format -i src/php/* .cc
Original file line number Diff line number Diff line change @@ -135,10 +135,7 @@ struct ACL_vector *convert_array_to_acl(Array *param_array) {
135135 return nullptr ;
136136 }
137137 std::string std_scheme = scheme.toStdString ();
138- char *scheme_buf = (char *) emalloc (std_scheme.length () + 1 );
139- bzero (scheme_buf, strlen (scheme_buf) + 1 );
140- strcpy (scheme_buf, std_scheme.c_str ());
141- create_acl.id .scheme = scheme_buf;
138+ create_acl.id .scheme = estrndup (std_scheme.c_str (), std_scheme.length ());
142139 Variant acl_struct_id = acl_array.get (" id" );
143140 if (scheme == nullptr ) {
144141 return nullptr ;
@@ -147,10 +144,7 @@ struct ACL_vector *convert_array_to_acl(Array *param_array) {
147144 return nullptr ;
148145 }
149146 std::string std_acl_struct_id = acl_struct_id.toStdString ();
150- char *acl_struct_id_buf = (char *) emalloc (std_acl_struct_id.length () + 1 );
151- bzero (acl_struct_id_buf, (std_acl_struct_id.length ()) + 1 );
152- strcpy (acl_struct_id_buf, std_acl_struct_id.c_str ());
153- create_acl.id .id = acl_struct_id_buf;
147+ create_acl.id .id = estrndup (std_acl_struct_id.c_str (), std_acl_struct_id.length ());
154148
155149 // 将结构体装入ACL
156150 acl_collect[i] = create_acl;
You can’t perform that action at this time.
0 commit comments