<commit_before>/*
 * getlocks.c :  entry point for get_locks RA functions for ra_serf
 *
 * ====================================================================
 *    Licensed to the Apache Software Foundation (ASF) under one
 *    or more contributor license agreements.  See the NOTICE file
 *    distributed with this work for additional information
 *    regarding copyright ownership.  The ASF licenses this file
 *    to you under the Apache License, Version 2.0 (the
 *    "License"); you may not use this file except in compliance
 *    with the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing,
 *    software distributed under the License is distributed on an
 *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 *    KIND, either express or implied.  See the License for the
 *    specific language governing permissions and limitations
 *    under the License.
 * ====================================================================
 */




#include <apr_uri.h>

#include <serf.h>

#include "svn_path.h"
#include "svn_pools.h"
#include "svn_ra.h"
#include "svn_dav.h"
#include "svn_time.h"
#include "svn_xml.h"

#include "private/svn_dav_protocol.h"
#include "private/svn_fspath.h"
#include "svn_private_config.h"

#include "../libsvn_ra/ra_loader.h"

#include "ra_serf.h"



/*
 * This enum represents the current state of our XML parsing for a REPORT.
 */
typedef enum lock_state_e {
  NONE = 0,
  REPORT,
  LOCK,
  PATH,
  TOKEN,
  OWNER,
  COMMENT,
  CREATION_DATE,
  EXPIRATION_DATE
} lock_state_e;

typedef struct lock_info_t {
  /* Temporary pool */
  apr_pool_t *pool;

  svn_lock_t *lock;

  /* The currently collected value as we build it up */
  const char *tmp;
  apr_size_t tmp_len;

} lock_info_t;

typedef struct lock_context_t {
  apr_pool_t *pool;

  /* target and requested depth of the operation. */
  const char *path;
  svn_depth_t requested_depth;

  /* return hash */
  apr_hash_t *hash;

  /* are we done? */
  svn_boolean_t done;

} lock_context_t;



static lock_info_t *
push_state(svn_ra_serf__xml_parser_t *parser,
           lock_context_t *lock_ctx,
           lock_state_e state)
{
  svn_ra_serf__xml_push_state(parser, state);

  if (state == LOCK)
    {
      lock_info_t *info;

      info = apr_pcalloc(parser->state->pool, sizeof(*info));

      info->pool = lock_ctx->pool;
      info->lock = svn_lock_create(lock_ctx->pool);
      info->lock->path =

      parser->state->private = info;
    }

  return parser->state->private;
}

static svn_error_t *
start_getlocks(svn_ra_serf__xml_parser_t *parser,
               void *userData,
               svn_ra_serf__dav_props_t name,
               const char **attrs)
{
  lock_context_t *lock_ctx = userData;
  lock_state_e state;

  state = parser->state->current_state;

  if (state == NONE &&
      strcmp(name.name, "get-locks-report") == 0)
    {
      push_state(parser, lock_ctx, REPORT);
    }
  else if (state == REPORT &&<commit_msg>* subversion/libsvn_ra_serf/getlocks.c:   (push_state): remove stray assignment<commit_after>/*
 * getlocks.c :  entry point for get_locks RA functions for ra_serf
 *
 * ====================================================================
 *    Licensed to the Apache Software Foundation (ASF) under one
 *    or more contributor license agreements.  See the NOTICE file
 *    distributed with this work for additional information
 *    regarding copyright ownership.  The ASF licenses this file
 *    to you under the Apache License, Version 2.0 (the
 *    "License"); you may not use this file except in compliance
 *    with the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing,
 *    software distributed under the License is distributed on an
 *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 *    KIND, either express or implied.  See the License for the
 *    specific language governing permissions and limitations
 *    under the License.
 * ====================================================================
 */




#include <apr_uri.h>

#include <serf.h>

#include "svn_path.h"
#include "svn_pools.h"
#include "svn_ra.h"
#include "svn_dav.h"
#include "svn_time.h"
#include "svn_xml.h"

#include "private/svn_dav_protocol.h"
#include "private/svn_fspath.h"
#include "svn_private_config.h"

#include "../libsvn_ra/ra_loader.h"

#include "ra_serf.h"



/*
 * This enum represents the current state of our XML parsing for a REPORT.
 */
typedef enum lock_state_e {
  NONE = 0,
  REPORT,
  LOCK,
  PATH,
  TOKEN,
  OWNER,
  COMMENT,
  CREATION_DATE,
  EXPIRATION_DATE
} lock_state_e;

typedef struct lock_info_t {
  /* Temporary pool */
  apr_pool_t *pool;

  svn_lock_t *lock;

  /* The currently collected value as we build it up */
  const char *tmp;
  apr_size_t tmp_len;

} lock_info_t;

typedef struct lock_context_t {
  apr_pool_t *pool;

  /* target and requested depth of the operation. */
  const char *path;
  svn_depth_t requested_depth;

  /* return hash */
  apr_hash_t *hash;

  /* are we done? */
  svn_boolean_t done;

} lock_context_t;



static lock_info_t *
push_state(svn_ra_serf__xml_parser_t *parser,
           lock_context_t *lock_ctx,
           lock_state_e state)
{
  svn_ra_serf__xml_push_state(parser, state);

  if (state == LOCK)
    {
      lock_info_t *info;

      info = apr_pcalloc(parser->state->pool, sizeof(*info));

      info->pool = lock_ctx->pool;
      info->lock = svn_lock_create(lock_ctx->pool);

      parser->state->private = info;
    }

  return parser->state->private;
}

static svn_error_t *
start_getlocks(svn_ra_serf__xml_parser_t *parser,
               void *userData,
               svn_ra_serf__dav_props_t name,
               const char **attrs)
{
  lock_context_t *lock_ctx = userData;
  lock_state_e state;

  state = parser->state->current_state;

  if (state == NONE &&
      strcmp(name.name, "get-locks-report") == 0)
    {
      push_state(parser, lock_ctx, REPORT);
    }
  else if (state == REPORT &&
{'fraction_non_alphanumeric': 0.1376354520459324, 'fraction_numerical': 0.0019408054342552159, 'mean_word_length': 3.3335669236159777, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 8}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4506882', 'n_tokens_mistral': 2121, 'n_tokens_neox': 2030, 'n_words': 572}