gboolean jabber_chat_affiliate_user(JabberChat *chat, const char *who, const char *affiliation) { JabberChatMember *jcm; const char *jid; char *to; JabberIq *iq; xmlnode *query, *item; jcm = g_hash_table_lookup(chat->members, who); if (jcm && jcm->jid) jid = jcm->jid; else if (g_utf8_strchr(who, -1, '@') != NULL) jid = who; else return FALSE; iq = jabber_iq_new_query(chat->js, JABBER_IQ_SET, "http://jabber.org/protocol/muc#admin"); to = g_strdup_printf("%s@%s", chat->room, chat->server); xmlnode_set_attrib(iq->node, "to", to); g_free(to); query = xmlnode_get_child(iq->node, "query"); item = xmlnode_new_child(query, "item"); xmlnode_set_attrib(item, "jid", jid); xmlnode_set_attrib(item, "affiliation", affiliation); jabber_iq_send(iq); return TRUE; }
/** * rb_uri_get_short_path_name: * @uri: a URI * * Returns the filename component of @uri, that is, everything after the * final slash and before the start of the query string or fragment. * * Return value: filename component of @uri, must be freed by caller */ char * rb_uri_get_short_path_name (const char *uri) { const char *start; const char *end; if (uri == NULL) return NULL; /* skip query string */ end = g_utf8_strchr (uri, -1, '?'); start = g_utf8_strrchr (uri, end ? (end - uri) : -1, '/'); if (start == NULL) { /* no separator, just a single file name */ } else if ((start + 1 == end) || *(start + 1) == '\0') { /* last character is the separator, so find the previous one */ end = start; start = g_utf8_strrchr (uri, (end - uri)-1, '/'); if (start != NULL) start++; } else { start++; } if (start == NULL) start = uri; if (end == NULL) { return g_strdup (start); } else { return g_strndup (start, (end - start)); } }
static gboolean e_name_western_detect_backwards (ENameWestern *name, ENameWesternIdxs *idxs) { gchar *comma; gchar *word; comma = g_utf8_strchr (name->full, -1, ','); if (comma == NULL) return FALSE; /* * If there's a comma, we need to detect whether it's * separating the last name from the first or just separating * suffixes. So we grab the word which comes before the * comma and check if it's a suffix. */ word = e_name_western_get_preceding_word (name->full, comma - name->full); if (e_name_western_word_is_suffix (word)) { g_free (word); return FALSE; } g_free (word); return TRUE; }
static DBusMessage * new_socket_call_message (AtkComponent *component, const char *member) { char *id = g_object_get_data (G_OBJECT (component), "dbus-plug-parent"); char *bus_parent; char *path_parent; if (!id) { g_warning ("new_socket_call_message: no id"); return NULL; } bus_parent = g_strdup (id); if (bus_parent && (path_parent = g_utf8_strchr (bus_parent + 1, -1, ':'))) { DBusMessage *message; *(path_parent++) = '\0'; message = dbus_message_new_method_call (bus_parent, path_parent, ATSPI_DBUS_INTERFACE_COMPONENT, member); g_free (bus_parent); return message; } return NULL; }
static void sanitize_alias(char *buffer) { size_t len = strlen(buffer); gchar *curr; while ((curr = g_utf8_strchr(buffer, len, '\n'))) { *curr = 0x20; } }
/*! \brief Get name and value from an attribute 'name=value' string. * \par Function Description * This function parses the character string \a string expected to be * an attribute string of the form 'name=value'. * * It returns TRUE if it has been able to parse the string into the * name and value parts of an attribute. Otherwise it returns FALSE, * in that case \a *name_ptr and \a *value_ptr are set to NULL. * * \a name_ptr and/or \a value_ptr can be NULL. * If not NULL, the caller must g_free these returned strings. * * \note * If you get an invalid attribute (improper) with a name and no * value, then it is NOT an attribute. Also, there cannot be any * spaces beside the equals sign * * \param [in] string String to split into name/value pair. * \param [out] name_ptr The return location for the name, or NULL. * \param [out] value_ptr The return location for the value, or NULL. * \return TRUE on success, FALSE otherwise. */ gboolean o_attrib_string_get_name_value (const gchar *string, gchar **name_ptr, gchar **value_ptr) { gchar *ptr, *prev_char, *next_char; if (name_ptr != NULL) *name_ptr = NULL; if (value_ptr != NULL) *value_ptr = NULL; g_return_val_if_fail (string != NULL, FALSE); ptr = g_utf8_strchr (string, -1, g_utf8_get_char ("=")); if (ptr == NULL) { return FALSE; } prev_char = g_utf8_find_prev_char (string, ptr); next_char = g_utf8_find_next_char (ptr, NULL); if (prev_char == NULL || *prev_char == ' ' || next_char == NULL || *next_char == ' ' || *next_char == '\0' ) { return FALSE; } if (name_ptr != NULL) { *name_ptr = g_strndup (string, (ptr - string)); } if (value_ptr != NULL) { *value_ptr = g_strdup (next_char); } return TRUE; }
/** * stf_parse_csv_is_separator: * * returns NULL if @character is not a separator, a pointer to the character * after the separator otherwise. **/ static char const * stf_parse_csv_is_separator (char const *character, char const *chr, GSList const *str) { g_return_val_if_fail (character != NULL, NULL); if (*character == 0) return NULL; if (str) { GSList const *l; for (l = str; l != NULL; l = l->next) { char const *s = l->data; char const *r; glong cnt; glong const len = g_utf8_strlen (s, -1); /* Don't compare past the end of the buffer! */ for (r = character, cnt = 0; cnt < len; cnt++, r = g_utf8_next_char (r)) if (*r == '\0') break; if ((cnt == len) && (memcmp (character, s, len) == 0)) return g_utf8_offset_to_pointer (character, len); } } if (chr && g_utf8_strchr (chr, -1, g_utf8_get_char (character))) return g_utf8_next_char(character); return NULL; }
/* * Renders an opcode. The opcodes can take an argument by adding trailing ':' * to the opcode and then a number format code */ static void render_opcode (GString *target, char /* non-const */ *opcode, HFRenderInfo *info, G_GNUC_UNUSED HFRenderType render_type) { char *args; char *opcode_trans; int i; args = g_utf8_strchr (opcode, -1, ':'); if (args) { *args = 0; args++; } opcode_trans = g_utf8_casefold (opcode, -1); for (i = 0; render_ops [i].name; i++) { if (render_ops [i].name_trans == NULL) { render_ops [i].name_trans = g_utf8_casefold (_(render_ops [i].name), -1); } if ((g_ascii_strcasecmp (render_ops [i].name, opcode) == 0) || (g_utf8_collate (render_ops [i].name_trans, opcode_trans) == 0)) { (*render_ops [i].render)(target, info, args); } } g_free (opcode_trans); }
static long strchr_offset (const gchar *str, gunichar c) { gchar *p = g_utf8_strchr (str, -1, c); if (p == NULL) return -1; return p - str; }
static bool has_slash(const struct nfs_buf *str) { if (!str) return false; if (g_utf8_strchr(str->val, str->len, '/')) return true; return false; }
void doc_entities_to_utf8(Tdocument * doc, gint start, gint end, gboolean numerical, gboolean iso8859_1, gboolean symbols, gboolean specials, gboolean xml) { gchar *buf; const gchar *found, *prevfound; guint docoffset = start; /* docoffset is an offset in characters between the buffer and the GtkTextBuffer contents */ buf = doc_get_chars(doc, start, end); utf8_offset_cache_reset(); found = g_utf8_strchr(buf, -1, '&'); while (found) { gchar *endfound; endfound = g_utf8_strchr(found, -1, ';'); if (endfound && endfound - found <= 7) { gchar *entity; gunichar unic; entity = g_strndup(found + 1, (endfound - found) - 1); /*unic = unichar_for_entity(entity,numerical,iso8859_1,symbols,specials,xml); */ unic = xmlentity2unichar(entity, numerical, iso8859_1, symbols, specials, xml); if (unic != -1) { guint cfound, cendfound; gchar tmp[7]; DEBUG_MSG("doc_entities_to_utf8, unic=%d for entity '%s'\n", unic, entity); memset(tmp, 0, 7); g_unichar_to_utf8(unic, tmp); cfound = utf8_byteoffset_to_charsoffset_cached(buf, (found - buf)); cendfound = utf8_byteoffset_to_charsoffset_cached(buf, (endfound - buf)); doc_replace_text_backend(doc, tmp, cfound + docoffset, cendfound + docoffset + 1); docoffset = docoffset - (cendfound + 1 - cfound) + 1; } g_free(entity); prevfound = g_utf8_next_char(endfound); found = g_utf8_strchr(prevfound, -1, '&'); } else { found = g_utf8_strchr(g_utf8_next_char(found), -1, '&'); } } }
/** * eventc_light_connection_read: * @connection: an #EventcLightConnection * * Reads the incoming data on connection socket. * * Returns: 0 if the read was successful, a negative %errno value otherwise */ EVENTD_EXPORT gint eventc_light_connection_read(EventcLightConnection *self) { g_return_val_if_fail(self != NULL, -EFAULT); gint error = 0; if ( ! _eventc_light_connection_expect_connected(self, &error) ) return error; gchar buf[4096]; gchar *buffer = self->buffer.buffer; gsize length = self->buffer.length; gsize o = length; gssize r; while ( ( r = recv(self->socket, buf, sizeof(buf), 0) ) > 0 ) { length += r; buffer = g_realloc(buffer, length); strncpy(buffer+o, buf, r); buffer[length] = '\0'; o = length; } if ( r == 0 ) { close(self->socket); self->socket = 0; error = 1; } else if ( ( errno != EAGAIN ) && ( errno != EWOULDBLOCK ) ) error = -errno; else { GError *error = NULL; o = 0; gchar *c; while ( ( c = g_utf8_strchr(buffer + o, length - o, '\n') ) != NULL ) { *c = '\0'; if ( ! eventd_protocol_parse(self->protocol, buffer + o, &error) ) { g_error_free(error); return -EINVAL; } o = c + 1 - buffer; } self->buffer.length = length - o; self->buffer.buffer = g_strndup(buffer + o, self->buffer.length); g_free(buffer); } return error; }
JabberID* jabber_id_new(const char *str) { char *at; char *slash; JabberID *jid; if(!str || !g_utf8_validate(str, -1, NULL)) return NULL; jid = g_new0(JabberID, 1); at = g_utf8_strchr(str, -1, '@'); slash = g_utf8_strchr(str, -1, '/'); if(at) { jid->node = g_utf8_normalize(str, at-str, G_NORMALIZE_NFKC); if(slash) { jid->domain = g_utf8_normalize(at+1, slash-(at+1), G_NORMALIZE_NFKC); jid->resource = g_utf8_normalize(slash+1, -1, G_NORMALIZE_NFKC); } else { jid->domain = g_utf8_normalize(at+1, -1, G_NORMALIZE_NFKC); } } else { if(slash) { jid->domain = g_utf8_normalize(str, slash-str, G_NORMALIZE_NFKC); jid->resource = g_utf8_normalize(slash+1, -1, G_NORMALIZE_NFKC); } else { jid->domain = g_utf8_normalize(str, -1, G_NORMALIZE_NFKC); } } if(!jabber_nodeprep_validate(jid->node) || !jabber_nameprep_validate(jid->domain) || !jabber_resourceprep_validate(jid->resource)) { jabber_id_free(jid); return NULL; } return jid; }
static void _j4status_flat_action(J4statusPluginContext *context, gchar *action_description) { gchar *event_id = action_description; gchar *section_id = g_utf8_strchr(action_description, -1, ' '); if ( section_id != NULL ) { *section_id++ = '\0'; j4status_core_trigger_action(context->core, section_id, event_id); } }
static int go_search_replace_compile (GOSearchReplace *sr) { const char *pattern; char *tmp; int flags = 0; int res; g_return_val_if_fail (sr && sr->search_text, GO_REG_EEND); kill_compiled (sr); if (sr->is_regexp) { pattern = sr->search_text; tmp = NULL; sr->plain_replace = (sr->replace_text && g_utf8_strchr (sr->replace_text, -1, '$') == NULL && g_utf8_strchr (sr->replace_text, -1, '\\') == NULL); } else { /* * Create a regular expression equivalent to the search * string. (Thus hoping the regular expression search * routines are pretty good.) */ GString *regexp = g_string_new (NULL); go_regexp_quote (regexp, sr->search_text); pattern = tmp = g_string_free (regexp, FALSE); sr->plain_replace = TRUE; } if (sr->ignore_case) flags |= GO_REG_ICASE; sr->comp_search = g_new0 (GORegexp, 1); res = go_regcomp (sr->comp_search, pattern, flags); g_free (tmp); return res; }
static const gchar * rejilla_image_format_read_path (const gchar *ptr, gchar **path) { const gchar *start, *end; /* make sure there is a white space */ if (!isspace (*ptr)) return NULL; /* jump over the white spaces */ while (isspace (*ptr)) ptr ++; /* seek the first '"' if any */ start = g_utf8_strchr (ptr, -1, '"'); if (start) { start ++; /* seek the last '"' */ end = g_utf8_strchr (start, -1, '"'); if (!end) return NULL; ptr = end + 1; } else { /* there is no starting '"' seek last space */ start = ptr; end = ptr; while (!isspace (*end)) end ++; ptr = end; if (isspace (*end)) end --; } if (path) *path = g_strndup (start, end-start); return ptr; }
static void gnc_price_cell_modify_verify (BasicCell *_cell, const char *change, int change_len, const char *newval, int newval_len, int *cursor_position, int *start_selection, int *end_selection) { PriceCell *cell = (PriceCell *) _cell; struct lconv *lc = gnc_localeconv (); const char *toks = "+-*/=()_"; gunichar decimal_point; gunichar thousands_sep; const char *c; gunichar uc; /* accept the newval string if user action was delete */ if (change == NULL) { gnc_basic_cell_set_value_internal (_cell, newval); cell->need_to_parse = TRUE; return; } if (cell->print_info.monetary) decimal_point = g_utf8_get_char(lc->mon_decimal_point); else decimal_point = g_utf8_get_char(lc->decimal_point); if (cell->print_info.monetary) thousands_sep = g_utf8_get_char(lc->mon_thousands_sep); else thousands_sep = g_utf8_get_char(lc->thousands_sep); c = change; while (*c) { uc = g_utf8_get_char (c); if (!g_unichar_isdigit (uc) && !g_unichar_isspace (uc) && !g_unichar_isalpha (uc) && (decimal_point != uc) && (thousands_sep != uc) && (g_utf8_strchr (toks, -1, uc) == NULL)) return; c = g_utf8_next_char (c); } gnc_basic_cell_set_value_internal (_cell, newval); cell->need_to_parse = TRUE; }
static void dates_save_changes (DatesData *d) { ECalComponentText text; const gchar *old_location = NULL; gchar *desc; GSList *desc_list; GtkTextIter start, middle, end; GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW ( d->details_textview)); GtkWidget *widget; ECalComponentText summary, new_summary; gtk_text_buffer_get_start_iter (buffer, &start); e_cal_component_get_location (d->comp, &old_location); /* If there was a location field set, try not to overwrite it */ if (old_location) { gtk_text_buffer_get_iter_at_line (buffer, &middle, 1); desc = gtk_text_buffer_get_text ( buffer, &start, &middle, FALSE); if (desc) { /* Strip the trailing new-line, if necessary */ gchar *strip; if ((strip = g_utf8_strchr (desc, -1, '\n'))) *strip = '\0'; e_cal_component_set_location (d->comp, desc); g_free (desc); } start = middle; } /* Set the rest of the description */ gtk_text_buffer_get_end_iter (buffer, &end); desc = gtk_text_buffer_get_text (buffer, &start, &end, FALSE); text.value = desc ? desc : ""; text.altrep = NULL; desc_list = g_slist_prepend (NULL, &text); e_cal_component_set_description_list (d->comp, desc_list); g_free (desc); g_slist_free (desc_list); widget = d->details_summary_entry; e_cal_component_get_summary (d->comp, &summary); new_summary.altrep = summary.altrep; new_summary.value = g_strdup (gtk_entry_get_text (GTK_ENTRY (widget))); e_cal_component_set_summary (d->comp, &new_summary); dates_commit_event_cb (NULL, d, CALOBJ_MOD_ALL); }
/* Determine where, if at all, a UTF8 substring occurs within another * UTF8 string. Return a pointer to the start of the substring, or * NULL if not found. */ static gchar* find_utf8_substr(gchar *str, gchar *substr) { /* record the first character of substr for scanning */ gunichar first = g_utf8_get_char(substr) ; /* record the collation key for substr for comparison */ gchar* substr_key = g_utf8_collate_key(substr, -1) ; /* record the length of substr, in bytes, for comparison. do this by finding the length, in utf8 characters, converting that to a pointer, then using pointer arithmetic to find the byte length. */ gssize len = g_utf8_offset_to_pointer(substr, g_utf8_strlen(substr, -1)) - substr ; /* scan the string looking for 'first' */ for ( /* start at the first occurrence of 'first' */ str = g_utf8_strchr(str, -1, first) ; /* continue as long as 'first' was found */ str != NULL ; /* for the next iteration, advance to the next occurrence * of 'first' */ str = g_utf8_strchr(g_utf8_next_char(str), -1, first) ) { /* compute the collation key for the 'len'-length * substring located at 'str' */ gchar* this_key = g_utf8_collate_key(str, len) ; /* get our comparison value */ int this_comp = strcmp(substr_key, this_key) ; /* free the collation key */ g_free(this_key) ; /* if comparison was 0 (equal), break out of the scan loop */ if (this_comp == 0) { break ; /* out of for(...) loop */ } } /* free up the collation key */ g_free(substr_key) ; /* return the result */ return(str) ; }
static gint e_name_western_str_count_words (const gchar *str) { gint word_count; const gchar *p; word_count = 0; for (p = str; p != NULL; p = g_utf8_strchr (p, -1, ' ')) { word_count++; p = g_utf8_next_char (p); } return word_count; }
GRegex *compileRegularExpression(GError **err) { const gchar *mustQuote = "*?+[(){}^$|\\./"; gchar pattern[32]; GRegex *regex = NULL; if (g_utf8_strchr(mustQuote, strlen(mustQuote), delimiter)) g_snprintf(pattern, 32, "^%c%c{1,2}", '\\', delimiter); else g_snprintf(pattern, 32, "^%c{1,2}", delimiter); regex = g_regex_new(pattern, G_REGEX_MULTILINE, 0, err); return regex; }
static gint print_tree_view_list_get_columns_data_nbre_lines ( GtkTreeView *tree_view ) { GtkTreeModel *model; GtkTreeIter iter; GList *list_tmp; gint nbre_lines = 0; model = gtk_tree_view_get_model ( tree_view ); if ( !gtk_tree_model_get_iter ( model, &iter, tree_path_to_print ) ) return 0; list_tmp = gtk_tree_view_get_columns ( tree_view ); while ( list_tmp ) { GtkTreeViewColumn *col; const gchar *text; gint nbre_motifs = 0; gint col_num_model; GType col_type_model; col = ( GtkTreeViewColumn * ) list_tmp -> data; col_num_model = GPOINTER_TO_INT ( g_object_get_data ( G_OBJECT ( col ), "num_col_model" ) ); col_type_model = gtk_tree_model_get_column_type ( model, col_num_model ); /* get the text */ if ( col_type_model == G_TYPE_STRING ) gtk_tree_model_get ( model, &iter, col_num_model, &text, -1 ); if ( text == NULL || strlen ( text ) == 0 ) { list_tmp = list_tmp -> next; continue; } if ( g_utf8_strchr ( text, -1, '\n' ) ) { nbre_motifs = utils_str_get_nbre_motifs ( text, "\n" ); if ( nbre_motifs > nbre_lines ) nbre_lines = nbre_motifs; } list_tmp = list_tmp -> next; } nbre_lines++; return nbre_lines; }
static void _wec_config_blacklist_update(gpointer data, struct t_config_option *option) { g_return_if_fail(option == _wec_context.config.restrictions.blacklist); g_hash_table_remove_all(_wec_context.blacklist); const gchar *nick, *s; nick = weechat_config_string(option); while ( ( s = g_utf8_strchr(nick, -1, ' ') ) != NULL ) { g_hash_table_add(_wec_context.blacklist, g_strndup(nick, s - nick)); nick = s + 1; } g_hash_table_add(_wec_context.blacklist, g_strdup(nick)); }
static DBusMessage * impl_GetChildAtIndex (DBusConnection * bus, DBusMessage * message, void *user_data) { AtkObject *object = (AtkObject *) user_data; DBusMessage *reply; dbus_int32_t i; AtkObject *child; g_return_val_if_fail (ATK_IS_OBJECT (user_data), droute_not_yet_handled_error (message)); if (!dbus_message_get_args (message, NULL, DBUS_TYPE_INT32, &i, DBUS_TYPE_INVALID)) { return droute_invalid_arguments_error (message); } if (ATK_IS_SOCKET (object) && atk_socket_is_occupied (ATK_SOCKET (object)) && i == 0) { AtkSocket *socket = ATK_SOCKET (object); gchar *child_name, *child_path; child_name = g_strdup (socket->embedded_plug_id); child_path = g_utf8_strchr (child_name + 1, -1, ':'); if (child_path) { DBusMessageIter iter, iter_socket; *(child_path++) = '\0'; reply = dbus_message_new_method_return (message); if (!reply) return NULL; dbus_message_iter_init_append (reply, &iter); dbus_message_iter_open_container (&iter, DBUS_TYPE_STRUCT, NULL, &iter_socket); dbus_message_iter_append_basic (&iter_socket, DBUS_TYPE_STRING, &child_name); dbus_message_iter_append_basic (&iter_socket, DBUS_TYPE_OBJECT_PATH, &child_path); dbus_message_iter_close_container (&iter, &iter_socket); return reply; } g_free (child_name); } child = atk_object_ref_accessible_child (object, i); reply = spi_object_return_reference (message, child); if (child) g_object_unref (child); return reply; }
void canonicalize_ldapserver(GqServer *server) { /* FIXME: should use better URI check */ server->is_uri = g_utf8_strchr(server->ldaphost, -1, ':') != NULL; if (server->is_uri) { g_free_and_dup(server->canon_name, server->ldaphost); } else { /* construct an LDAP URI */ GString *str = g_string_sized_new(100); g_string_sprintf(str, "ldap://%s:%d/", server->ldaphost, server->ldapport); g_free(server->canon_name); server->canon_name = str->str; g_string_free(str, FALSE); } }
static gsize _j4status_nl_section_append_addresses(gchar *str, gsize size, GList *list) { gsize o = 0; GList *addr; for ( addr = list ; addr != NULL ; addr = g_list_next(addr) ) { gchar *p; nl_addr2str(rtnl_addr_get_local(addr->data), str + o, size - o); p = g_utf8_strchr(str + o, -1, '/'); g_assert_nonnull(p); /* We know libnl wrote the prefix length */ *p = '\0'; o += p - str; o += g_snprintf(str + o, size - o, ", "); } return o; }
static gboolean _evhelpers_filename_check_data_base64_prefix(const gchar *string) { gchar *c; gsize s; c = g_utf8_strchr(string, -1, ','); s = c - string; if ( ( c == NULL ) || ( s < strlen(";base64") ) ) return FALSE; c = g_utf8_strrchr(string, s, ';'); if ( ( c == NULL ) || ( ! g_str_has_prefix(c, ";base64") ) ) return FALSE; return TRUE; }
static gint print_tree_view_list_get_title_size ( void ) { gint size_tmp = 0; gint size_line; gint nbre_lines = 1; if ( g_utf8_strchr ( title_string, -1, '\n' ) ) nbre_lines = utils_str_get_nbre_motifs ( title_string, "\n" ) + 1; /* Add a blank line */ nbre_lines++; size_line = pango_font_description_get_size ( gsb_data_print_config_get_font_title () ); size_tmp = size_line * nbre_lines / PANGO_SCALE; return size_tmp; }
/** Examine an extension menu item and see if it already has an * accelerator key defined (in the source). If so, add this key to * the map of already used accelerator keys. These maps are * maintained per path, so accelerator keys may be duplicated across * different menus but are guaranteed to be unique within any given * menu. * * @param info A menu extension. * * @param table A hash table of accelerator maps. */ static void gnc_menu_additions_do_preassigned_accel (ExtensionInfo *info, GHashTable *table) { gchar *map, *new_map, *accel_key; const gchar *ptr; ENTER("Checking %s/%s [%s]", info->path, info->ae.label, info->ae.name); if (info->accel_assigned) { LEAVE("Already processed"); return; } if (!g_utf8_validate(info->ae.label, -1, NULL)) { g_warning("Extension menu label '%s' is not valid utf8.", info->ae.label); info->accel_assigned = TRUE; LEAVE("Label is invalid utf8"); return; } /* Was an accelerator pre-assigned in the source? */ ptr = g_utf8_strchr(info->ae.label, -1, '_'); if (ptr == NULL) { LEAVE("not preassigned"); return; } accel_key = g_utf8_strdown(g_utf8_next_char(ptr), 1); DEBUG("Accelerator preassigned: '%s'", accel_key); /* Now build a new map. Old one freed automatically. */ map = g_hash_table_lookup(table, info->path); if (map == NULL) map = ""; new_map = g_strconcat(map, accel_key, (gchar *)NULL); DEBUG("path '%s', map '%s' -> '%s'", info->path, map, new_map); g_hash_table_replace(table, info->path, new_map); info->accel_assigned = TRUE; g_free(accel_key); LEAVE("preassigned"); }
static gchar * comment_parse_subject(gchar const *comment) { gchar *ptr; gchar *subject; if (ptr = g_utf8_strchr(comment, g_utf8_strlen(comment, -1), '\n')) { subject = g_strndup(comment, ptr - comment); } else { subject = g_strdup(comment); } gchar *commit = g_strconcat("commit:", subject, NULL); g_free(subject); return commit; }