Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
pike
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pikelang
pike
Commits
a94d7c85
Commit
a94d7c85
authored
Jul 7, 2013
by
Bill Welliver
Browse files
Options
Downloads
Patches
Plain Diff
Standards.BSON: accelerated array handling sorts properly.
parent
a226ea50
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/post_modules/BSON/bson.cmod
+27
-12
27 additions, 12 deletions
src/post_modules/BSON/bson.cmod
with
27 additions
and
12 deletions
src/post_modules/BSON/bson.cmod
+
27
−
12
View file @
a94d7c85
...
@@ -41,8 +41,6 @@
...
@@ -41,8 +41,6 @@
/*
/*
Types left to implement
Types left to implement
| "\x03" e_name document Embedded document
| "\x04" e_name document Array
| "\x0F" e_name code_w_s JavaScript code w/ scope
| "\x0F" e_name code_w_s JavaScript code w/ scope
*/
*/
/*! @class Sample
/*! @class Sample
...
@@ -420,8 +418,15 @@ char * decode_next_value(struct pike_string * pike_slist, char * n, struct mappi
...
@@ -420,8 +418,15 @@ char * decode_next_value(struct pike_string * pike_slist, char * n, struct mappi
struct pike_string * d;
struct pike_string * d;
struct mapping * doc;
struct mapping * doc;
struct array * arr;
struct array * arr;
INT_TYPE asize;
int32_t len;
int32_t len;
/* used by NEW_MAPPING_LOOP */
const struct keypair *k=0;
const struct mapping_data *md;
INT32 e;
int32_t left = pike_slist->len - (n - slist);
int32_t left = pike_slist->len - (n - slist);
if(left < 4)
if(left < 4)
{
{
Pike_error("invalid BSON. not enough data 11.\n");
Pike_error("invalid BSON. not enough data 11.\n");
...
@@ -438,16 +443,26 @@ char * decode_next_value(struct pike_string * pike_slist, char * n, struct mappi
...
@@ -438,16 +443,26 @@ char * decode_next_value(struct pike_string * pike_slist, char * n, struct mappi
d = make_shared_binary_string(n, len);
d = make_shared_binary_string(n, len);
doc = decode_document(d);
doc = decode_document(d);
free_string(d);
free_string(d);
ref_push_mapping(doc);
f_indices(1);
// arrays are encoded as mappings with indices containing
push_mapping(doc);
// string representations of the index number.
f_values(1);
arr = Pike_sp[-1].u.array;
asize = m_sizeof(doc);
add_ref(arr);
arr = allocate_array(asize);
pop_stack();
md = doc->data;
ref_push_array(arr);
f_sort(2);
NEW_MAPPING_LOOP(md)
{
INT_TYPE i;
push_svalue(&k->ind);
o_cast_to_int();
i = Pike_sp[-1].u.integer;
pop_stack();
pop_stack();
ITEM(arr)[i] = k->val;
}
free_mapping(doc);
push_array(arr);
push_array(arr);
n += (len);
n += (len);
break;
break;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment