File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -117,6 +117,39 @@ static int skip(struct dcp_parse_ctx *handle)
117117 }
118118}
119119
120+ static int skip_pair (struct dcp_parse_ctx * handle )
121+ {
122+ int ret ;
123+
124+ ret = skip (handle );
125+ if (ret )
126+ return ret ;
127+
128+ return skip (handle );
129+ }
130+
131+ static bool consume_string (struct dcp_parse_ctx * ctx , const char * specimen )
132+ {
133+ struct dcp_parse_tag * tag ;
134+ const char * key ;
135+ ctx -> pos = round_up (ctx -> pos , 4 );
136+
137+ if (ctx -> pos + sizeof (* tag ) + strlen (specimen ) - 1 > ctx -> len )
138+ return false;
139+ tag = ctx -> blob + ctx -> pos ;
140+ key = ctx -> blob + ctx -> pos + sizeof (* tag );
141+ if (tag -> padding )
142+ return false;
143+
144+ if (tag -> type != DCP_TYPE_STRING ||
145+ tag -> size != strlen (specimen ) ||
146+ strncmp (key , specimen , tag -> size ))
147+ return false;
148+
149+ skip (ctx );
150+ return true;
151+ }
152+
120153/* Caller must free the result */
121154static char * parse_string (struct dcp_parse_ctx * handle )
122155{
You can’t perform that action at this time.
0 commit comments