Skip to content

Commit 9d723e8

Browse files
addaleaxjasnell
authored andcommitted
buffer: remove pointless C++ utility methods
PR-URL: #12760 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Timothy Gu <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]> Reviewed-By: Сковорода Никита Андреевич <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 20e27dd commit 9d723e8

File tree

1 file changed

+13
-73
lines changed

1 file changed

+13
-73
lines changed

src/node_buffer.cc

+13-73
Original file line numberDiff line numberDiff line change
@@ -516,36 +516,6 @@ void StringSlice<UCS2>(const FunctionCallbackInfo<Value>& args) {
516516
}
517517

518518

519-
void Latin1Slice(const FunctionCallbackInfo<Value>& args) {
520-
StringSlice<LATIN1>(args);
521-
}
522-
523-
524-
void AsciiSlice(const FunctionCallbackInfo<Value>& args) {
525-
StringSlice<ASCII>(args);
526-
}
527-
528-
529-
void Utf8Slice(const FunctionCallbackInfo<Value>& args) {
530-
StringSlice<UTF8>(args);
531-
}
532-
533-
534-
void Ucs2Slice(const FunctionCallbackInfo<Value>& args) {
535-
StringSlice<UCS2>(args);
536-
}
537-
538-
539-
void HexSlice(const FunctionCallbackInfo<Value>& args) {
540-
StringSlice<HEX>(args);
541-
}
542-
543-
544-
void Base64Slice(const FunctionCallbackInfo<Value>& args) {
545-
StringSlice<BASE64>(args);
546-
}
547-
548-
549519
// bytesCopied = copy(buffer, target[, targetStart][, sourceStart][, sourceEnd])
550520
void Copy(const FunctionCallbackInfo<Value> &args) {
551521
Environment* env = Environment::GetCurrent(args);
@@ -712,36 +682,6 @@ void StringWrite(const FunctionCallbackInfo<Value>& args) {
712682
}
713683

714684

715-
void Base64Write(const FunctionCallbackInfo<Value>& args) {
716-
StringWrite<BASE64>(args);
717-
}
718-
719-
720-
void Latin1Write(const FunctionCallbackInfo<Value>& args) {
721-
StringWrite<LATIN1>(args);
722-
}
723-
724-
725-
void Utf8Write(const FunctionCallbackInfo<Value>& args) {
726-
StringWrite<UTF8>(args);
727-
}
728-
729-
730-
void Ucs2Write(const FunctionCallbackInfo<Value>& args) {
731-
StringWrite<UCS2>(args);
732-
}
733-
734-
735-
void HexWrite(const FunctionCallbackInfo<Value>& args) {
736-
StringWrite<HEX>(args);
737-
}
738-
739-
740-
void AsciiWrite(const FunctionCallbackInfo<Value>& args) {
741-
StringWrite<ASCII>(args);
742-
}
743-
744-
745685
static inline void Swizzle(char* start, unsigned int len) {
746686
char* end = start + len - 1;
747687
while (start < end) {
@@ -1222,19 +1162,19 @@ void SetupBufferJS(const FunctionCallbackInfo<Value>& args) {
12221162
Local<Object> proto = args[0].As<Object>();
12231163
env->set_buffer_prototype_object(proto);
12241164

1225-
env->SetMethod(proto, "asciiSlice", AsciiSlice);
1226-
env->SetMethod(proto, "base64Slice", Base64Slice);
1227-
env->SetMethod(proto, "latin1Slice", Latin1Slice);
1228-
env->SetMethod(proto, "hexSlice", HexSlice);
1229-
env->SetMethod(proto, "ucs2Slice", Ucs2Slice);
1230-
env->SetMethod(proto, "utf8Slice", Utf8Slice);
1231-
1232-
env->SetMethod(proto, "asciiWrite", AsciiWrite);
1233-
env->SetMethod(proto, "base64Write", Base64Write);
1234-
env->SetMethod(proto, "latin1Write", Latin1Write);
1235-
env->SetMethod(proto, "hexWrite", HexWrite);
1236-
env->SetMethod(proto, "ucs2Write", Ucs2Write);
1237-
env->SetMethod(proto, "utf8Write", Utf8Write);
1165+
env->SetMethod(proto, "asciiSlice", StringSlice<ASCII>);
1166+
env->SetMethod(proto, "base64Slice", StringSlice<BASE64>);
1167+
env->SetMethod(proto, "latin1Slice", StringSlice<LATIN1>);
1168+
env->SetMethod(proto, "hexSlice", StringSlice<HEX>);
1169+
env->SetMethod(proto, "ucs2Slice", StringSlice<UCS2>);
1170+
env->SetMethod(proto, "utf8Slice", StringSlice<UTF8>);
1171+
1172+
env->SetMethod(proto, "asciiWrite", StringWrite<ASCII>);
1173+
env->SetMethod(proto, "base64Write", StringWrite<BASE64>);
1174+
env->SetMethod(proto, "latin1Write", StringWrite<LATIN1>);
1175+
env->SetMethod(proto, "hexWrite", StringWrite<HEX>);
1176+
env->SetMethod(proto, "ucs2Write", StringWrite<UCS2>);
1177+
env->SetMethod(proto, "utf8Write", StringWrite<UTF8>);
12381178

12391179
if (auto zero_fill_field = env->isolate_data()->zero_fill_field()) {
12401180
CHECK(args[1]->IsObject());

0 commit comments

Comments
 (0)